This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$sms = "Dear {{name}}, {{amount}} has been deposited to your bank account. Your current balance is {{balance}}. Thank you for banking with us."; | |
$required = ['{{name}}','{{amount}}','{{balance}}']; | |
$values = [ | |
$required[0] => 'John Doe', | |
$required[1] => 'KES 5,000', | |
$required[2] => 'KES 75,000' | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
pip install virtualenv virtualenvwrapper-win | |
mkdir \Projects\helloworld && cd \Projects\helloworld | |
mkvirtualenv helloworld | |
setprojectdir . | |
deactivate | |
workon helloworld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$phone = "0748123456"; // safaricom | |
//$phone = "+254789123456"; // airtel | |
$safaricom = "/(+?254|0|^){1}[-. ]?[7]{1}([0-2]{1}[0-9]{1}|[5|9]{1}[0-9]{1}|[4]{1}[0-4]{1}|[4]{1}[6|8]{1})[0-9]{6}z/"; | |
$equitel = "/(\+?254|0|^){1}[-. ]?[7]{1}([6]{1}[3-5]{1})[0-9]{6}\z/"; | |
$airtel = "/(\+?254|0|^){1}[-. ]?[7]{1}([3]{1}[0-9]{1}|[5]{1}[0-6]{1}|[8]{1}[0-2|5-9]{1})[0-9]{6}\z/"; | |
$telcom = "/(\+?254|0|^){1}[-. ]?[7]{1}([7]{1}[0-9]{1})[0-9]{6}\z/"; | |
if(preg_match($safaricom, $phone)){ | |
echo 'SAFARICOM'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$kra_regex = "/^[A]{1}[0-9]{9}[a-zA-Z]{1}$/"; | |
$kra_pin = "A001234567J"; | |
if(preg_match($kra_regex, $kra_pin)){ | |
echo "Success! Valid KRA PIN"; | |
} | |
else{ | |
echo "Error! Invalid KRA PIN"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ext.postBuildExtras = { | |
dependencies { | |
// Multidex lib for Android v4 | |
compile 'com.android.support:multidex:1.0.3' | |
} | |
android { | |
dexOptions { | |
jumboMode true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream php { | |
server unix:/var/run/php/php7.2-fpm.sock; | |
} | |
server { | |
listen 80; | |
server_name www.example.com example.com; | |
root /var/www/example.com; | |
index index.html index.php; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `test` ( | |
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, | |
`name` VARBINARY(100) NULL | |
PRIMARY KEY (`id`)) | |
ENGINE = InnoDB | |
DEFAULT CHARACTER SET = utf8 | |
COLLATE = utf8_general_ci; | |
INSERT INTO test (name) | |
VALUE (AES_ENCRYPT('valuegoeshere','secretkeygoeshere')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE backup | |
SET agent_code = ELT(1 + FLOOR(RAND()*8), | |
'73572689', | |
'82778947', | |
'65857689', | |
'93335986', | |
'39894552', | |
'25344286', | |
'35939776', | |
'79822264'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<bool> SendPushNotification() | |
{ | |
var applicationID = "xxx"; | |
var senderId = "xxx"; | |
var deviceId = "xxxx" | |
using (var client = new HttpClient()) | |
{ | |
//do something with http client | |
client.BaseAddress = new Uri("https://fcm.googleapis.com"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set global sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; | |
set session sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; |