Skip to content

Instantly share code, notes, and snippets.

View UchePhilz's full-sized avatar
🤓

Uchephilz UchePhilz

🤓
View GitHub Profile
@UchePhilz
UchePhilz / alert-rsi-overbought-oversold.mq5
Last active July 1, 2023 17:19
MT5 Alert RSI Overbought and Undersold
//+------------------------------------------------------------------+
//| Powers EA |
//| Copyright 2020, PowersEA |
//| http://www.uchepowers.com |
//+------------------------------------------------------------------+
#include <Trade/Trade.mqh>
CTrade trade;
int rsiHandle;
@UchePhilz
UchePhilz / curl_get_curl_post.php
Created April 28, 2019 17:26
Curl GET and Curl Post function to consume endpoints (YII2)
public static function curlPost($arr, $url, $type) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
@UchePhilz
UchePhilz / time_laspe.php
Created April 28, 2019 17:23
function to get the time past from a date
public static function time_elapsed_string($datetime, $full = false, $msgFuture = "to go", $msgPresent = " just now", $msgPast = " ago") {
if (isset($datetime)) {
$now = new \DateTime;
$date = new \DateTime($datetime);
$diff = $now->diff($date);
$datePosition = " ago";
if ($now < $date) {
$datePosition = $msgFuture;
}
@UchePhilz
UchePhilz / get_first_day_ and_last_day_of_period.php
Created April 28, 2019 17:20
Get the first and last date of period (year, quarter,'month, week)
public static function firstDayOf($period, \DateTime $date = null) {
$period = strtolower($period);
$validPeriods = array('year', 'quarter', 'month', 'week');
if (!in_array($period, $validPeriods))
throw new \InvalidArgumentException('Period must be one of: ' . implode(', ', $validPeriods));
$newDate = ($date === null) ? new \DateTime() : clone $date;
switch ($period) {
@UchePhilz
UchePhilz / yii2_database_tenancy
Last active April 28, 2019 17:30
Php how to implement database multi-tenancy (YII2)
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace app\assets;
@UchePhilz
UchePhilz / versioning_the_chaos
Last active April 11, 2019 23:12
Versioning The Chaos (How to begin versioning your software in a chaotic environment)
Versioning The Chaos
You may find yourself in a company or team where new features are released as hotfixes,A Team where Alpha & Beta are one and the same, in this kind of environment the end users become the testers of your application.
You are not alone! A lot of software engineers have found themselves stuck in such situation. Some left for a more organized company, others endured till the end, while some found a way to manage the situation by versioning.
Why versioning?
My answer is that it gives your brain the chance to pace itself. Studies have shown that writing out your tasks helps eliminate stress and makes people more organized & focused on accomplishing their tasks.
Let me use a real scenario to illustrate how versioning can combat chaos.