Skip to content

Instantly share code, notes, and snippets.

View rummykhan's full-sized avatar
🎯
Focusing

Rehan Manzoor rummykhan

🎯
Focusing
View GitHub Profile
1. Copy MandrillServiceProvider in app/Providers/ directory.
2. Copy Mandrill in app/Facades/ directory
3. add MandrillServiceProvider in providers array
'providers' => [
\App\Providers\MandrillServiceProvider::class,
]
@rummykhan
rummykhan / permutations.py
Created September 26, 2017 19:15
Find the permutations of a string
def permutations(s):
result = [x for x in s]
copy = []
for i in s:
for v in result:
copy.append(i + v)
result = copy + result
watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
@rummykhan
rummykhan / yii-2-behavior-classes.php
Last active November 12, 2017 19:09
All Classes in Yii 2 thats extends yii\base\Behavior class and hence can provide any behavior.
0 => "yii\base\ActionFilter"
1 => "yii\behaviors\AttributeBehavior"
2 => "yii\behaviors\AttributeTypecastBehavior"
3 => "yii\behaviors\AttributesBehavior"
4 => "yii\behaviors\BlameableBehavior"
5 => "yii\behaviors\SluggableBehavior"
6 => "yii\behaviors\TimestampBehavior"
7 => "yii\filters\AccessControl"
8 => "yii\filters\AjaxFilter"
9 => "yii\filters\ContentNegotiator"
@rummykhan
rummykhan / problem
Last active December 26, 2017 13:19
Get all the customers who placed their first order this month
Schema
------
customer
id
username
created_at
order
@rummykhan
rummykhan / observer.js
Created December 16, 2018 07:55
Simplistic Javascript Observer - Novice
var T_HTML = 'T_HTML';
var T_VAL = 'T_VAL';
var T_TEXT = 'T_TEXT';
var T_FUNCTION = 'T_FUNCTION';
window.Observer = {
types: [T_HTML, T_VAL, T_TEXT, T_FUNCTION],
add: function (key, value, observer, type) {
var that = this;
<?php
/**
An array A consisting of N different integers is given. The array contains integers in the range [1..(N + 1)], which means that exactly one element is missing.
Your goal is to find that missing element.
Write a function:
function solution($A);
<?php
$a = [1, 2, 3, 4, 6, 7];
sort($a);
if ($a[0] != 1) {
return 0;
}
@rummykhan
rummykhan / ImageAwareInterface.php
Last active April 8, 2021 20:35
Generic Image Aware Interface
<?php
namespace App\Models\ImageAware;
interface ImageAwareInterface
{
public function saveImage($file, $attribute = 'image', $disk = 'local');
public function getImageUrl($attribute = 'image', $default = null);
}
@rummykhan
rummykhan / ImageAwareTrait.php
Last active April 8, 2021 20:35
Generic Image Aware Trait
<?php
namespace App\Models\ImageAware;
use Illuminate\Http\UploadedFile;
trait ImageAwareTrait
{
/**
* Save image and get image name