This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Services; | |
use App\Services\FileDownloadService; | |
use Illuminate\Http\UploadedFile; | |
class ImageMigrationService | |
{ | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Services; // this will be the namespace according to your file path | |
use Illuminate\Http\UploadedFile; | |
use Illuminate\Support\Facades\Http; | |
use Exception; | |
/** | |
* Follow this gist to find out how to finally unlink and upload image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Services; // this will be the namespace according to your file path | |
use Illuminate\Http\UploadedFile; | |
use Illuminate\Support\Facades\Http; | |
use Illuminate\Support\Facades\Log; | |
use Exception; | |
class ImageMigrationService |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Problem 1 | |
function findPairs($nums) { | |
$count = 0; | |
$len = count($nums); | |
if ($len <= 1) { return 0; } | |
for ($i=0; $i < $len; $i++) { | |
for ($j=$i+1; $j < $len; $j++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Injectable} from '@angular/core'; | |
import {HttpClient, HttpParams} from '@angular/common/http'; | |
@Injectable() | |
export class MainService { | |
constructor(protected http: HttpClient) {} | |
private readonly baseUrl = "127.0.0.1:8000/api"; // here use your project's base url | |
private additionalUrl = "/employees"; // here use your remaining route url | |
protected _url = `${this.baseUrl}${this.additionalUrl}`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core'; | |
import {Subject} from 'rxjs'; | |
import {takeUntil} from 'rxjs/operators'; | |
import {MatTableDataSource} from '@angular/material'; | |
import {MainService} from './service/main.service'; | |
// this will be your shared component path | |
import {BasicPaginationComponent} from '../shared/components/basic-pagination/basic-pagination.component'; | |
@Component({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table mat-table *ngIf="dataSource; else noDataFound" [dataSource]="dataSource"> | |
<!-- Name Column --> | |
<ng-container matColumnDef="name"> | |
<th mat-header-cell *matHeaderCellDef mat-sort-header> Name</th> | |
<td mat-cell *matCellDef="let row"> {{row.name}} </td> | |
</ng-container> | |
<!-- Email Column --> | |
<ng-container matColumnDef="email"> | |
<th mat-header-cell *matHeaderCellDef mat-sort-header> Email </th> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string} haystack | |
* @param {string} needle | |
* @return {number} | |
*/ | |
function KMP(text, pattern){ | |
let LPS = preProcess(pattern); | |
let i=0, j=0; | |
while(i < text.length && j < pattern.length){ | |
if(text[i] == pattern[j]){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function preProcess(pattern) { | |
let lps = new Array(pattern.length); | |
let i = 0, j = 1; lps[0] = 0; | |
while (j < pattern.length) { | |
if(pattern[j] == pattern[i]) { | |
lps[j] = i + 1; | |
i++; | |
j++; | |
} else if(i != 0) { | |
i = lps[i-1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List of bank sources: | |
[ | |
"imf": { | |
"description": "The International Monetary Fund (IMF) is an organization of 188 countries, working to foster global monetary cooperation, secure financial stability, facilitate international trade, promote high employment and sustainable economic growth, and reduce poverty around the world.", | |
"source": "imf", | |
"name": "International Monetary Fund", | |
"source_url": "http://www.imf.org/", | |
"available_from_date": "2020-05-05" | |
}, |
NewerOlder