Skip to content

Instantly share code, notes, and snippets.

View danyal14's full-sized avatar

Danyal AB danyal14

View GitHub Profile
@danyal14
danyal14 / csruleset.xml
Created June 26, 2019 10:24
Laravel Standards for PHP Code Sniffer
<?xml version="1.0"?>
<ruleset name="Laravel Standards">
<description>The Laravel Coding Standards</description>
<rule ref="Generic.Classes.DuplicateClassName"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".php\{0,1\}$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true
<div id="demo">
<input type="text" v-model="text"> text: {{text}}
<input type="file" v-model="file"> file: {{file}}
</div>
ar vue = new Vue({
el: '#demo',
// default values
$categories = [
[
'name' => 'cat1',
'children' => [
[
'name' => 'cat1',
'children' => [
[
'name'=>'subcat1',
'children'=> []
{
"mobile_front_prime": {
"sizes": [
[300, 250],
[320, 320],
[320, 160],
[320, 50],
"fluid"
],
"lazyLoad": false,
@danyal14
danyal14 / ActivityLog.php
Last active August 6, 2020 08:47
Traits in PHP and Laravel
<?php
use App\Http\Traits\ActivityLog;
trait ActivityLog {
public function storeLog($message, $object) {
// Store $message and $object in database
SomeModel::create([
'message' => $message,
'object_class' = get_class($object),
'user_id' => Auth::user()->id
apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
# Commands to clean the local docker env
# Step1: stop all processes
docker stop $(docker ps -aq)
# Step2: remove all containers
docker rm $(docker ps -aq)
# Step3: remove all images
docker rmi $(docker images -aq)
@danyal14
danyal14 / cloudwatch_log_insights_mysql_slow_query_examples.md
Created September 1, 2022 08:10 — forked from qiangxue/cloudwatch_log_insights_mysql_slow_query_examples.md
CloudWatch Log Insights query examples for MySQL slow query log.

Filtering queries

Find slowest write queries

parse @message /Query_time: (?<queryTime>.*?) Lock_time: (<?lockTime>.*?) Rows_sent: (?<rowsSent>.*?) Rows_examined: (?<rowsExamined>.*?)\s(?<query>.*?)$/
  | filter @message like /(?i)insert/
  | sort queryTime desc
  | limit 10