Skip to content

Instantly share code, notes, and snippets.

View hassansw's full-sized avatar
🎯
Focusing

Hassan Saleem hassansw

🎯
Focusing
View GitHub Profile
@hassansw
hassansw / FragmentHome.kt
Created October 4, 2017 14:22
Creating a Fragment with Kotlin
class FragmentHome : Fragment() {
//Any other widgets such as Button, Layouts and etc be declared also like this
var tvHomeLabel:TextView? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
@hassansw
hassansw / react-native-maps-enable-google-maps-instructions.md
Created April 15, 2018 16:14 — forked from heron2014/react-native-maps-enable-google-maps-instructions.md
Visual instructions how to enable Google Maps on IOS using react-native-maps

Visual instructions how to enable Google Maps on IOS using react-native-maps

This is for my personal use, things might not be correctly explained here. For the official docs please check https://github.com/airbnb/react-native-maps

Steps from scratch:

1.react-native init GoogleMapPlayground

2. cd GoogleMapPlayground

@hassansw
hassansw / customDate.js
Last active April 25, 2018 09:50
modify and get Date format of your choice :)
//A special thanks to Sabih Siddiqui : https://github.com/siddiquisabih
changeDateToCurrentTimezone(date) {
let splitDate = date.split('-')
let year = parseInt(splitDate[0])
let month = parseInt(splitDate[1])
let splitCurrentDate = splitDate[2]
let newDate = splitCurrentDate.split('T')
let day = parseInt(newDate[0])
@hassansw
hassansw / filter.pipe.ts
Created May 4, 2018 06:53
Angular Filter Pipe
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'filter'
})
export class FilterPipe implements PipeTransform {
transform(items: any[], searchText: string): any[] {
if (!items) return [];
if (!searchText) return items;
searchText = searchText.toLowerCase();
return items.filter(it => {
@hassansw
hassansw / filter.js
Last active May 10, 2018 13:10
Javascript Filter
listOfObjects.filter(x => x.obj > 1); //or any other condition to filter the list
listOfObjects.filter(x => anotherList.includes(x.anyObject));
@hassansw
hassansw / app.component.ts
Last active July 3, 2018 07:34
Angular Asynch ngFor
import { Component, OnInit, AfterViewInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Title } from "@angular/platform-browser";
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/delay';
@Component({
@hassansw
hassansw / cookies.injectable.ts
Created July 4, 2018 09:05
Cookies Injectable
import { Injectable } from '@angular/core';
@Injectable()
export class CookieService {
constructor() { }
public getCookie(name: string): any | null {
let ca: Array<string> = document.cookie.split(';');
let caLen: number = ca.length;
@hassansw
hassansw / alphabet-soup.markdown
Created November 5, 2018 10:00
Alphabet Soup
@hassansw
hassansw / check-duplicate.js
Created December 4, 2018 14:13
Find Duplicate objects in an Array of Objects in Javascript
function checkDuplicateInObject(propertyName, inputArray) {
let seenDuplicate = false, testObject = {};
let dupItem = null
inputArray.map((item) => {
const itemPropertyName = item[propertyName];
if (itemPropertyName in testObject) {
testObject[itemPropertyName].duplicate = true;
item.duplicate = true;
seenDuplicate = true;
A. Create Installation DVD ISO Via Dism:
1. Extract Win 10 Enterprise version of the mirror sources folder install.wim to D drive temp directory
2. In the temp directory to create WimMount folder, and execute the following command to mount the wim file
Dism /Mount-Wim /WimFile:D:\temp\install.wim /Index:1 /MountDir:D:\temp\WimMount
3. Show the current version
Dism /Image:D:\temp\WimMount /Get-CurrentEdition
4. Show current version
Dism /Image:D:\temp\WimMount /Get-TargetEditions