Skip to content

Instantly share code, notes, and snippets.

View tanvir002700's full-sized avatar
🏠
Working from home

Tanvir Hasan Anick tanvir002700

🏠
Working from home
View GitHub Profile
url = Object.keys(data).map(function(k) {
return encodeURIComponent(k) + '=' + encodeURIComponent(data[k])
}).join('&');
@tanvir002700
tanvir002700 / Ajax.js
Created December 16, 2016 06:39
Ajax Library
var Library = {};
Library.toQueryString = function(data){
if(data){
var qstring = [];
for (var key in data){
qstring.push(encodeURIComponent(key)+"="+encodeURIComponent(data[key]));
}
data = qstring.join("&");
return data;
}else{
@tanvir002700
tanvir002700 / (1) index.html
Last active June 5, 2023 14:48
Upload CSV file with Jquery.
<html>
<head>
<title>CSV upload</title>
</head>
<body>
<input type="file" name="filename" id="filename">
<button id="upload">upload</button>
<div class="csv"></div>
@tanvir002700
tanvir002700 / pubnub_singleton.rb
Last active November 10, 2016 15:08
Ruby singleton class for pubnub push notification.
require 'singleton'
class PubnubSingleton
include Singleton
attr_accessor :pubnub
def initialize
@pubnub = Pubnub.new(
publish_key: ENV['PUBNUB_PUBLISH_KEY'],
subscribe_key: ENV['PUBNUB_SUBSCRIBE_KEY'],
@tanvir002700
tanvir002700 / add_intellij_launcer
Created August 16, 2016 03:40 — forked from rob-murray/add_intellij_launcer
Add Intellij launcher shortcut and icon for ubuntu
// create file:
sudo vim /usr/share/applications/intellij.desktop
// add the following
[Desktop Entry]
Version=13.0
Type=Application
Terminal=false
Icon[en_US]=/home/rob/.intellij-13/bin/idea.png
Name[en_US]=IntelliJ
#include<stdio.h>
#include<vector>
using namespace std;
int main()
{
vector<int>v(10);
for(int i=0;i<v.size();i++)
{
scanf("%d",&v[i]);
}
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
string input = "abc,def,ghi";
stringstream ss(input);
string token;
while(std::getline(ss, token, ','))
{
#include<iostream>
#include<sstream>
#include<string>
using namespace std;
int main()
{
string s1="This is example of String Stream";
stringstream Stream1(s1);
string token;
while(Stream1>>token)
Graph=[] #this list for storing for graph
visit=[] #this list for visit checking
paretn=[] #this list for save parent
def dfs(u):
global visit #using global variable
global parent
if(visit[u]):return #if this u node previously visited then return
visit[u]=True #now u node mark as visited
for v in Graph[u]: #take all node v which is adjacency with u
parent[v]=u #take v parent's u
from queue import PriorityQueue
def dijkstra(G,src,des):
dist=[(268435456)]*len(G) #create dist list & initial with inf value
Q=PriorityQueue() #create priority queue
dist[src]=0 #source dist is always zero
Q.put((0,src)) #push source with zero dist in queue
while(Q.empty()==False): #iterate until queue is empty
cost,u=Q.get() #take minimum dist, node & pop up
if(u==des):return dist[des] #if destination find from Q, then return result
for v,Cost in G[u]: #take all node which is adjacency with u node