Skip to content

Instantly share code, notes, and snippets.

View rummykhan's full-sized avatar
🎯
Focusing

Rehan Manzoor rummykhan

🎯
Focusing
View GitHub Profile
<?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);
@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;
@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 / 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"
watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
@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
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 / lumen_ide_helper.php
Created August 29, 2017 12:47 — forked from barryvdh/lumen_ide_helper.php
Lumen IDE Helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel Lumen (5.1.1) (Laravel Components 5.1.*) on 2015-08-18.
*
* @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
#!/bin/bash
function send_email () {
echo sending email;
}
mongo --eval "db.stats()" > /dev/null # do a simple harmless command of some sort
RESULT=$? # returns 0 if mongo eval succeeds
@rummykhan
rummykhan / .bashrc
Created July 23, 2017 17:01
Original Bash RC
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi