Skip to content

Instantly share code, notes, and snippets.

View monbang's full-sized avatar
🌴
On vacation

monbang

🌴
On vacation
View GitHub Profile
@monbang
monbang / UserUpdateForm.php
Created June 16, 2020 06:37
yii validation 2
<?php
namespace app\models;
// proper update unique validation solution:-- https://stackoverflow.com/a/44473290
use Yii;
use yii\base\Model;
class UserUpdateForm extends Model
@monbang
monbang / UserCreateForm.php
Created June 16, 2020 06:37
yii validations 1
<?php
namespace app\models;
use Yii;
use yii\base\Model;
class UserCreateForm extends Model
{
public $name;
@monbang
monbang / vue dating
Created June 8, 2020 00:05
vue dating
vue dating
=========================
1. picker: vuejs-datepicker
2. from laravel (j.n.Y) to js date(d.M.yyyy) with date-fns
=> this.start = parse(this.currentObj.start_date, 'd.M.yyyy', new Date());
3. from js date to laravel (j.n.Y) date
=> this.form.start_date = format(this.start, 'd.M.yyyy');
@monbang
monbang / lara note
Last active May 21, 2020 17:15
lara note
<?php
=> factory(App\User::class)->create();
=> factory(App\User::class, 10)->create();
=> artisan help make:factory
=> artisan make:factory ArticleFactory -m "App\Article"
=> $factory->define(Article::class, function(Faker $faker){
return [
'user_id' => factory(\App\User::class), // belongs to
'title' => $faker->sentence,
@monbang
monbang / unix commands
Created May 11, 2020 06:05
unix commands
Unix commands
==========================
1. find a file by name
- find / -name my.cnf
@monbang
monbang / z-kitbag
Created May 9, 2020 14:02
z-kitbag
Z-KITBAG
-----------------
Z - zameeni nishan
K - khabar
I - irrada
T - tareeka
B - bandobast
A - administration
G - ghadi milao
@monbang
monbang / Duplicates in table
Created May 4, 2020 03:34
Duplicates in table
// https://stackoverflow.com/a/2594855
SELECT name,
reg_no,
CLASS,
SECTION,
count(*)
FROM cps_student
GROUP BY name,
reg_no
@monbang
monbang / The Best Medium-Hard Data Analyst SQL Interview Questions
Created May 3, 2020 16:15
The Best Medium-Hard Data Analyst SQL Interview Questions
# The Best Medium-Hard Data Analyst SQL Interview Questions
By Zachary Thomas ([zthomas.nc@gmail.com](mailto:zthomas.nc@gmail.com), [Twitter](https://twitter.com/zach_i_thomas), [LinkedIn](https://www.linkedin.com/in/thomaszi/))
**Tip: **See the Table of Contents (document outline) by hovering over the vertical line on the right side of the page
## Background & Motivation
> The first 70% of SQL is pretty straightforward but the remaining 30% can be pretty tricky.
@monbang
monbang / Yii2 module wise user login
Created May 1, 2020 15:31
Yii2 module wise user login
public function init()
{
parent::init();
Yii::$app->set('user', [
'class' => 'yii\web\User',
'identityClass' => 'app\models\Editor',
'enableAutoLogin' => false,
'loginUrl' => ['yonetim/default/login'],
'identityCookie' => ['name' => 'editor', 'httpOnly' => true],
@monbang
monbang / cps exam
Created May 1, 2020 07:05
cps exam
cps exam module:-
------------------------
1. exam timing and questions have state, resume from where left off,
2. question and answers can be both text and image,
3. question has only a single answer,
4. question option 4,
5. student by registration id,
6. exam schedule by class/section/subject,