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
char* strmerge(char* str1, char* str2){ | |
char* str = (char*)malloc(strlen(str1) + strlen(str2) + 1); | |
strcpy(str, str1); | |
strcat(str, str2); | |
return str; | |
} |
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
char* intToStr(int num){ | |
char* str = (char*)malloc(12); | |
sprintf(str, "%d", num); | |
return str; | |
} |
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
//Convert char to wchar_t | |
bool char2wchar_t(char *str1, wchar_t *str2){ | |
std::wstringstream st; | |
st << str1; | |
return !(st >> str2).fail(); | |
}; |
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
class listNode{ | |
public: | |
listNode *previous; | |
listNode *next; | |
int val; | |
bool remove(){ | |
this->previous->next=this->next; | |
this->next->previous=this->previous; | |
delete this; | |
return true; |
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
// Priority Queue | |
function PriorityQueue(){ | |
this.list = new Array() | |
this.push = function(el, priority){ | |
this.list.push([el, priority]); | |
} | |
this.pop = function(){ | |
if(this.list.length == 0) | |
return null; | |
var minPriority = this.list[0][1]; |
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
/* File comments updated: Sunday, March 25, 2012 at 12:38 AM | |
* | |
* COLLISION SYSTEM: provides functions to create collision objects | |
* and detect collisions between objects and points. | |
* Used by most animated objects on the canvas to detect collisions. | |
*/ | |
// POINT: contains an x and y position | |
function Point(x, y){ | |
this.x = x; |
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 <string> | |
using namespace std; | |
bool BracketsInclusion(string str){ | |
int length = str.length(); | |
// Remove everything besides brackets | |
string bstr =""; | |
for(int i = 0; i<length; 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
import tweepy | |
import os | |
# Consumer keys and access tokens, used for OAuth | |
consumer_key = '' | |
consumer_secret = '' | |
access_token = '' | |
access_token_secret = '' | |
# OAuth process, using the keys and tokens |
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
import tweepy | |
import os | |
import json | |
# Consumer keys and access tokens | |
consumer_key = '' | |
consumer_secret = '' | |
access_token = '' | |
access_token_secret = '' |
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 urllib2 import Request, urlopen, URLError | |
def findURL(page_srt, res): | |
try: | |
att = "url"+res | |
start_ind = page_srt.index(att) | |
end_ind = page_srt.index("?",start_ind) | |
url = page_srt[(start_ind+len(att)+1):end_ind] | |
return url | |
except: |
OlderNewer