Skip to content

Instantly share code, notes, and snippets.

View NimzyMaina's full-sized avatar

Nimrod Maina NimzyMaina

View GitHub Profile
@NimzyMaina
NimzyMaina / GTBank.php
Last active November 11, 2016 07:58
GT Bank Web Service Test
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$url = 'https://196.200.24.46/Rent/Service1.asmx?wsdl';
// options for ssl in php 5.6.5
$opts = array(
'ssl' => array('ciphers'=>'RC4-SHA', 'verify_peer'=>false, 'verify_peer_name'=>false)
);
@NimzyMaina
NimzyMaina / valid_email.js
Created July 18, 2017 09:27
vaidate domain of an email
jQuery.validator.methods.email = function( value, element ) {
var email = /^([\w-.]+@(gmail|yahoo|hotmail|icloud)(\.+)?[a-zA-Z])\/?/;
return email.test(value);
}
@NimzyMaina
NimzyMaina / disable.sql
Created October 4, 2017 15:47
Disable MYSQL Strict Mode
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';
@NimzyMaina
NimzyMaina / push.cs
Created October 6, 2017 09:57
Send FCM
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");
@NimzyMaina
NimzyMaina / random-data.sql
Created October 31, 2017 12:52
Updating MySQL tables with random data
UPDATE backup
SET agent_code = ELT(1 + FLOOR(RAND()*8),
'73572689',
'82778947',
'65857689',
'93335986',
'39894552',
'25344286',
'35939776',
'79822264');
@NimzyMaina
NimzyMaina / crypt.sql
Last active January 10, 2018 14:45
Encrypt and Decrypt MYSQL
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'));
@NimzyMaina
NimzyMaina / gist:fd2812120e6db1d4086f43339f5f550f
Last active November 14, 2018 16:29
Codeigniter Nginx Web config
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;
@NimzyMaina
NimzyMaina / build-extras.gradle
Created December 13, 2018 14:22
This is a custom gradle modification for Ionic
ext.postBuildExtras = {
dependencies {
// Multidex lib for Android v4
compile 'com.android.support:multidex:1.0.3'
}
android {
dexOptions {
jumboMode true
@NimzyMaina
NimzyMaina / virtualenv.sh
Created April 4, 2019 11:00
Virtualenv Commands
#!/bin/bash
pip install virtualenv virtualenvwrapper-win
mkdir \Projects\helloworld && cd \Projects\helloworld
mkvirtualenv helloworld
setprojectdir .
deactivate
workon helloworld
@NimzyMaina
NimzyMaina / sms.php
Created April 23, 2019 06:47
Bulk SMS Templating
<?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'
];