Skip to content

Instantly share code, notes, and snippets.

View gist:9b5c7dc1d1b7b7fd3fba60e4aebdc6fc
#include<bits/stdc++.h>
using namespace std;
// please not at any time we will keep elements in the map called mp whose index lie between i to j.
// Initially both are 0 so only first element is added in the map
int solution(int a[], int n)
{
set<int> st; // to store all the elements to find number of unique elements
for(int i = 0; i < n; i++){
View mappage.css
#mapSection {
height: 100%;
position: absolute;
width: 100%;
}
.card{
padding: 10px;
View mappage.ts
job: Job;
user_location: any;
error_message: string;
constructor(public jobget: JobSetGetService, public router: Router, public apiProvider: ApicallsService) {
}
// Initialize Components
ngOnInit() {
this.job = this.jobget.jobInfo;
View form.html
<form #jobSearchForm="ngForm" (ngSubmit)="formSubmit()">
<div class="form-group">
<label for="search">Job Title</label>
<input type="text" class="form-control" id="search"
[(ngModel)]="model.search" required name="search"
#name="ngModel">
</div>
<div class="form-group">
<label for="location">Location</label>
View mappage.html
<div class="row">
<div id="mapSection">
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">{{job.title}}</h4>
<h6 class="card-subtitle mb-2 text-muted">{{job.company}} | {{job.date}} | <span class="money"><i
class="fa fa-money" aria-hidden="true" style="color: green;"></i>{{job.salary}}</span></h6>
<p class="card-text">{{job.description}}</p>
<div class="row bottom_info">
View homepage.ts
// go to map page
goToMap(job: Job) {
this.jobset.jobInfo = job;
this.router.navigate(['map']);
}
// On form submit
formSubmit() {
this.apiProvider.getCareerJetResults(this.model.search, this.model.location)
.subscribe((jobs) => {
View card.html
<div class="card" (click)="goToMap(job)">
<div class="card-block">
<h4 class="card-title">{{job.title}}</h4>
<h6 class="card-subtitle mb-2 text-muted">{{job.company}} | {{job.date}} | <span class="money"><i
class="fa fa-money" aria-hidden="true" style="color: green;"></i>{{job.salary}}</span></h6>
<p class="card-text">{{job.description}}</p>
<div class="row bottom_info">
<span><i class="fa fa-map-marker" aria-hidden="true" style="color: red;"></i>{{job.locations}}</span>
<span class="url_link" style="right: 0"><a href="{{job.url}}" target="_blank" class="card-link"><i
class="fa fa-link" aria-hidden="true"></i></a></span>
View gist:721e82851f1396702226b025cf06e939
ngOnInit() {
if (this.jobset.jobs.length < 1) {
this.apiProvider.getCareerResults('', 'Halifax, NS')
.subscribe((jobs) => {
this.jobset.jobs = jobs;
this.jobs = this.jobset.jobs;
},
(error) => {
this.error_message = <string>error;
});
View APICallService.ts
places_url = '/googleplaces';
matrix_url = '/distancematrix';
constructor(public http: Http) {
}
// make a http call to careerjet public API and return and return an observable
getCareerJetResults(search, location): Observable<Job[]> {
@Abiwax
Abiwax / app.js
Created Oct 4, 2017
Node MySQL connection
View app.js
var mysql = require('mysql');
var express = require('express');
var app = express();
var connection = mysql.createConnection({
host : "localhost",
user : "username",
password: "yourpassword",
database: "Example"
});