Skip to content

Instantly share code, notes, and snippets.

View ovicko's full-sized avatar
🎯
Focusing

AMWOLLO VICTOR ovicko

🎯
Focusing
View GitHub Profile
customer: {
"firstname":"firstname",
"lastname":"lastname",
"email":"email",
"phone":"phone",
},
seller_id:17,
delivery_type:"sendy default"
delivery_cost: 34.90,
@ovicko
ovicko / RecordsController.php
Last active May 19, 2021 10:06
Trigger the event after bulk upload
<?php
public function actionBulk() {
$model = new Records();
//import excel sheet with 5k records
if ($model->customImport()) {
//trigger the send email event 
$model->trigger(Records::EVENT_SEND_EMAIL_UPDATE);
}
}
@ovicko
ovicko / Records.php
Last active May 19, 2021 11:09
Add sendMail method to ActiveRecord class.
<?php
class Records extends \yii\db\ActiveRecord
{
 const EVENT_SEND_EMAIL_UPDATE = 'send-email-to-users';
 public function init() {
$this->on(self::EVENT_SEND_EMAIL_UPDATE, [$this, 'sendMail']);
//use this if you want to add custom data to your events
@ovicko
ovicko / Records.php
Last active May 19, 2021 10:05
Attach the event handler in the init method of your ActiveRecord.
<?php
class Records extends \yii\db\ActiveRecord
{
const EVENT_SEND_EMAIL_UPDATE = 'send-email-to-users';
public function init()
{
// first parameter is the name of the event and second is the handler. 
// sendMail method from $this class.
$this->on(self::EVENT_SEND_EMAIL_UPDATE, [$this, 'sendMail']);
parent::init(); // DON'T Forget to call the parent method.
@ovicko
ovicko / Records.php
Last active May 19, 2021 10:04
Create a constant that will identify the event in your ActiveRecord class.
<?php
class Records extends \yii\db\ActiveRecord
{
//create the event name
const EVENT_SEND_EMAIL_UPDATE = ‘send-email-to-users’;
}

👋 Hi! I'm Victor, a Web and Android Developer with passion in ecommerce and have specialized in building custom software to enable entrepreneurs launch and grow their online business

@ovicko
ovicko / DeCryptor.java
Created June 12, 2019 20:43 — forked from JosiasSena/DeCryptor.java
Encryptor and Decryptor for data encryption.decryption using the Android KeyStore.
/**
_____ _____ _
| __ \ / ____| | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__|
| |__| | __/ |____| | | |_| | |_) | || (_) | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_|
__/ | |
|___/|_|
*/
@ovicko
ovicko / RetrofitHelper.java
Last active June 11, 2019 18:09
RetrofitHelper
public class RetrofitHelper {
private Retrofit.Builder retrofit;
public RetrofitHelper() {
retrofit = new Retrofit.Builder()
.baseUrl(RetrofitApi.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(new OkHttpClient()
.newBuilder()
.addNetworkInterceptor(
@ovicko
ovicko / media-query.css
Created June 2, 2019 15:00 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
2019-05-19 11:06:51.590 14508-15246/one.block.androidexampleapp W/System.err: one.block.eosiojava.error.session.TransactionSignAndBroadCastError: one.block.eosiojava.error.session.TransactionCreateSignatureRequestRpcError: Error happened on calling getRequiredKeys RPC call.
2019-05-19 11:06:51.590 14508-15246/one.block.androidexampleapp W/System.err: at one.block.eosiojava.session.TransactionProcessor.signAndBroadcast(TransactionProcessor.java:483)
2019-05-19 11:06:51.591 14508-15246/one.block.androidexampleapp W/System.err: at one.block.androidexampleapp.TransactionTask.doInBackground(TransactionTask.java:140)
2019-05-19 11:06:51.591 14508-15246/one.block.androidexampleapp W/System.err: at one.block.androidexampleapp.TransactionTask.doInBackground(TransactionTask.java:34)
2019-05-19 11:06:51.591 14508-15246/one.block.androidexampleapp W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:345)
2019-05-19 11:06:51.591 14508-15246/one.block.androidexampleapp W/System.err: at java.util.