Skip to content

Instantly share code, notes, and snippets.

View Azhovan's full-sized avatar
🎯
Log the error and degrade gracefully!

Jabar Asadi Azhovan

🎯
Log the error and degrade gracefully!
View GitHub Profile
@Azhovan
Azhovan / mac-setup-redis.md
Created May 7, 2020 21:48 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@Azhovan
Azhovan / FastFibo.go
Last active December 1, 2019 19:15
High-performance Fibonacci numbers implementation in Golang
package main
import (
"fmt"
"math/big"
)
func main() {
fmt.Println(Fib(1000))
}
@Azhovan
Azhovan / Uppercase-lowercase.go
Last active October 19, 2019 11:14
change single character to Uppercase or lowercase (not unicode)
package main
import (
"bytes"
"fmt"
"unicode"
)
func main() {
@Azhovan
Azhovan / fileChuncker.go
Last active September 23, 2019 15:43
chunk file into smaller pieces
package util
// chunk the file into smaller pieces
func Chunks(path string) (parts uint64, filepath string) {
file := openFile(path)
defer closeFile(file)
fileInfo := fileInfo(file)
@Azhovan
Azhovan / time.go
Created September 23, 2019 10:13
golang time utility functions
package util
import (
"time"
)
// convert hour to timestamp
// this function assume the parameter as an hour in a day
@Azhovan
Azhovan / gist:6bc7ce4824ab3e0797f42f563af03731
Created February 23, 2019 11:51
Ubuntu minimum sourcelist
deb http://archive.ubuntu.com/ubuntu bionic main multiverse restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe
@Azhovan
Azhovan / supervisord.conf
Created June 17, 2018 12:04 — forked from jasonamyers/supervisord.conf
A sample supervisor config file
; Sample supervisor config file.
;
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
;
; Note: shell expansion ("~" or "$HOME") is not supported. Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
@Azhovan
Azhovan / 1_phpunit-api.md
Created December 3, 2017 13:11 — forked from loonies/1_phpunit-api.md
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this->anything()
@Azhovan
Azhovan / install.sh
Created November 24, 2017 07:35 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
<?php
class DemoSubject implements SplSubject{
private $observer, $value;
public function __construct(){
$this->observers = array();
}