Skip to content

Instantly share code, notes, and snippets.

Avatar
🍮
well caffeinated

mohammed osama secmohammed

🍮
well caffeinated
View GitHub Profile
@secmohammed
secmohammed / resp3.md
Created Apr 3, 2020 — forked from antirez/resp3.md
RESP3 protocol draft
View resp3.md

RESP3 specification

Versions history:

  • 1.0, 2 May 2018, Initial draft to get community feedbacks.

Background

The Redis protocol has served us well in the past years, showing that, if carefully designed, a simple human readable protocol is not the bottleneck in the client server communication, and that the simplicity of the design is a major advantage in creating a healthy client libraries ecosystem.

Yet the Redis experience has shown that after about six years from its introduction (when it replaced the initial Redis protocol), the current RESP protocol could be improved, especially in order to make client implementations simpler and to support new features.

@secmohammed
secmohammed / structs_interface.go
Created Jan 21, 2020 — forked from josephspurrier/structs_interface.go
Golang - Understand Structs and Interfaces
View structs_interface.go
// Also available at: https://play.golang.org/p/yTTpB5gB6C
package main
import (
"fmt"
)
// *****************************************************************************
// Example 1 - Struct vs Struct with Embedded Type
@secmohammed
secmohammed / ResolverWithMutation.ts
Created Aug 11, 2019
type-graphql validating inputs using yup instead of class-validator
View ResolverWithMutation.ts
```
const validationSchema = yup.object().shape({
email: yup
.string()
.min(3, emailNotLongEnough)
.max(255)
.email(invalidEmail)
.required(),
password: yup
.string()
@secmohammed
secmohammed / .zshrc
Last active May 6, 2019
zsh configuration
View .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/mohammed/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@secmohammed
secmohammed / gist:d2aeeee9ba18b68b8ec56cfd02b2e9c4
Last active Mar 10, 2019
How do I force “git pull” to overwrite local files?
View gist:d2aeeee9ba18b68b8ec56cfd02b2e9c4
First do a commit of your changes
git add *
git commit -a -m "local file server commit message"
Then fetch the changes and overwrite if there is a conflict
git fetch origin master
git merge -s recursive -X theirs origin/master
@secmohammed
secmohammed / laravel_exists_rule_snippet.md
Last active Mar 5, 2019
laravel exists rule validation
View laravel_exists_rule_snippet.md
  • when using the Rule class to check on existence of specific record while validation , a query builder is being returned that can be used for nested checks
Rule::exists('addresses', 'id')->where(function($builder) {
  $builder->where('user_id', auth()->id());
})
                

That's an alternative to creating a couple of "exists" rule like the following: