Skip to content

Instantly share code, notes, and snippets.

View ayushgp's full-sized avatar
😁

Ayush Gupta ayushgp

😁
View GitHub Profile
@ayushgp
ayushgp / query.cc
Last active February 15, 2016 10:27
Xapian 'contains' method for OmegaScript
//Added this at line 886:
CMD_contains,
//Added the function description at line 1012
T(contains, 2, 2, N, 0), //return position of substring, if not found return empty string
//Implemented contains function at line
case CMD_contains: {
size_t pos = args[1].find(args[0]);
if(pos!=string::npos){
/*
Roll No: 101403051
Name: Ayush Gupta
Group: COE3
Question: 1
*/
#include<bits/stdc++.h>
using namespace std;
#include<iostream>
using namespace std;
template<class T> struct Node{
T data;
Node<T>* next;
Node(T t){
this->data = t;
}
};
var relativeDate = function(date){
var month = ["January", "February", "March", "April", "May", "June","July", "August", "September", "October", "November", "December"];
var now = new Date();
if(date === now){
return "Just now";
}
var yearDiff = date.getYear()-now.getYear();
var monDiff = date.getMonth()-now.getMonth();
var dateDiff = date.getDate()-now.getDate();
if(date.toDateString() === now.toDateString())