This file contains 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
url = Object.keys(data).map(function(k) { | |
return encodeURIComponent(k) + '=' + encodeURIComponent(data[k]) | |
}).join('&'); |
This file contains 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
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{ |
This file contains 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
<html> | |
<head> | |
<title>CSV upload</title> | |
</head> | |
<body> | |
<input type="file" name="filename" id="filename"> | |
<button id="upload">upload</button> | |
<div class="csv"></div> |
This file contains 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
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'], |
This file contains 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
// 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 |
This file contains 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
#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]); | |
} |
This file contains 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
#include <iostream> | |
#include <sstream> | |
using namespace std; | |
int main() | |
{ | |
string input = "abc,def,ghi"; | |
stringstream ss(input); | |
string token; | |
while(std::getline(ss, token, ',')) | |
{ |
This file contains 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
#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) |
This file contains 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
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 |
This file contains 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
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 |
NewerOlder