Skip to content

Instantly share code, notes, and snippets.

whatever you seek is seeking you - Rumi

Yousuf Jawwad debuggerpk

whatever you seek is seeking you - Rumi
Block or report user

Report or block debuggerpk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
debuggerpk /
Created Sep 27, 2018
Flattens a nested array
def flatten(nested_array, start=[]):
[flatten(x, start) if type(x) == list else start.append(x) for x in nested_array]
return start
# test
given_array = [[1, 2, [3]], 4]
debuggerpk /
Created May 6, 2018 — forked from rochapablo/
Gulp Task to transform Typescript path imports into relative paths using the tsconfig

from this

import Head from '~components/Commons/Head';

to this

View middleware.ts
export const actionToPlainObjectMiddleware = store => next => action => {
if (typeof action === 'object' && action.type) {
const toForward = { ...action };
return next(toForward);
} else if (typeof action === 'function') {
let toForward = action();
toForward = { ...toForward };
return next(toForward);
} else {
throw new Error('Action must be FSA');

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

debuggerpk /
Created Sep 1, 2017 — forked from staltz/
The introduction to Reactive Programming you've been missing
debuggerpk / RestService.ts
Created Jul 13, 2017
Base Rest Service for angular
View RestService.ts
import { Headers, RequestOptionsArgs, Response, Request } from '@angular/http';
import { Observable } from 'rxjs/Observable';
interface IRestConfig {
baseHeaders?: Headers;
baseUrl: string;
path?: string;
interface IRestQuery {
debuggerpk /
Created Mar 15, 2017 — forked from patrickhammond/
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL"
debuggerpk /
Created Jan 5, 2017
Map Reduce Example
import itertools, json, operator
from string import capwords
from django.core import serializers
from django.db.models.manager import Manager, QuerySet
from django.utils import timezone as _tz
from dateutil.relativedelta import *
from dateutil import parser as dt_parser
debuggerpk / file-reader.js
Created Jan 5, 2017
angular directive example
View file-reader.js
'use strict';
export default function fileReader($q) {
return {
restrict: 'E',
scope: {
label: '@',
accept: '@',
maxSize: '@',
debuggerpk /
Created Jan 5, 2017
Unique for M2M fields
from django.db.models import QuerySet, Manager
class BaseRankManager(Manager):
def rank(self, field_name, user_id, **kwargs):
Gets unique items from the datebase based on the foreign key. this
queryset is ordered in reverse chronological order.
You can’t perform that action at this time.