Skip to content

Instantly share code, notes, and snippets.

View debuggerpk's full-sized avatar
🖖
whatever you seek is seeking you - Rumi

Yousuf Jawwad debuggerpk

🖖
whatever you seek is seeking you - Rumi
View GitHub Profile
@debuggerpk
debuggerpk / cv.sql
Last active December 30, 2016 08:18
creating view
CREATE VIEW "lineitems_vista" AS
SELECT
id,
created_at,
updated_at,
shift_id,
itms.name as name,
quantity,
transaction_id,
itms.price as unit_price,
@debuggerpk
debuggerpk / managers.py
Created January 5, 2017 23:20
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.
Args:
@debuggerpk
debuggerpk / file-reader.js
Created January 5, 2017 23:25
angular directive example
'use strict';
export default function fileReader($q) {
'ngInject';
return {
restrict: 'E',
scope: {
label: '@',
accept: '@',
maxSize: '@',
@debuggerpk
debuggerpk / mr.py
Created January 5, 2017 23:30
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
debuggerpk / android_instructions.md
Created March 15, 2017 13:19 — forked from patrickhammond/android_instructions.md
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 https://raw.github.com/Homebrew/homebrew/go/install)"

@debuggerpk
debuggerpk / RestService.ts
Created July 13, 2017 01:06
Base Rest Service for angular
import { Headers, RequestOptionsArgs, Response, Request } from '@angular/http';
import { Observable } from 'rxjs/Observable';
interface IRestConfig {
baseHeaders?: Headers;
baseUrl: string;
path?: string;
}
interface IRestQuery {
@debuggerpk
debuggerpk / introrx.md
Created September 1, 2017 12:19 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

Effective Engineer - Notes

What's an Effective Engineer?

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

Adopt the Right Mindsets

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');
@debuggerpk
debuggerpk / README.md
Created May 6, 2018 23:14 — forked from rochapablo/README.md
Gulp Task to transform Typescript path imports into relative paths using the tsconfig

from this

import Head from '~components/Commons/Head';
require('~images/test.jpg')

to this