This file contains hidden or 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; | |
consumer_key = 'CONSUMER KEY HERE' | |
consumer_key_secret = 'CONSUMER KEY SECRET HERE' | |
access_token = 'ACCESS TOKEN HERE' | |
access_token_secret = 'ACCESS TOKEN SECRET HERE' | |
key = tweepy.OAuthHandler(consumer_key, consumer_key_secret) | |
key.set_access_token(access_token , access_token_secret) |
This file contains hidden or 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; | |
consumer_key = 'CONSUMER KEY HERE' | |
consumer_key_secret = 'CONSUMER KEY SECRET HERE' | |
access_token = 'ACCESS TOKEN HERE' | |
access_token_secret = 'ACCESS TOKEN SECRET HERE' | |
class TweetListener(tweepy.StreamListener): | |
def on_status(self , status): |
This file contains hidden or 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
function nextPalindrome(num) { | |
let incrementSize = 1; | |
let incPalindrome = 0; | |
let decPalindrome = 0; | |
let sign = Math.sign(num); | |
while(incPalindrome === 0) { | |
if(sign === -1) { | |
var pal1 = ((num + incrementSize) * -1).toString().split('').reverse().join(''); | |
} else { |
This file contains hidden or 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
/** | |
* @param {string} s | |
* @return {boolean} | |
*/ | |
var isValid = function(s) { | |
let stack = new Stack(); | |
for(let char of s) { | |
let top = stack.peek(); | |
if(char === '}' && top === '{') { |
This file contains hidden or 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
/** | |
* @param {number} x | |
* @return {number} | |
*/ | |
var reverse = function(x) { | |
let sign = Math.sign(x); | |
let res = sign * parseInt(x.toString().split('').reverse().join('')) | |
if(res <= Math.pow(-2,31) || res >= Math.pow(2, 31) - 1) { | |
return 0; |
This file contains hidden or 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
/** | |
* @param {number[]} nums | |
* @return {number[]} | |
*/ | |
var findDuplicates = function(nums) { | |
let duplicates = []; | |
let obj = {}; | |
for(let num of nums) { | |
if(obj[num] && obj[num] !== 2){ |
This file contains hidden or 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 random import randint | |
import os | |
class Deck(object): | |
def __init__(self, values = ['nothing',1,2,3,4,5,6,7,8,9,10,11], cards = ['nothing','A', 'A', 'A', 'A', '2', '2', '2', '2', '3', '3', '3', '3', '4', '4', '4', '4', | |
'5', '5', '5', '5', '6', '6', '6', '6', '7', '7', '7', '7', '8', '8', '8', '8', '9', '9', '9', '9', | |
'10', '10', '10', '10', 'J', 'J', 'J', 'J', 'Q', 'Q', 'Q', 'Q', 'K', 'K', 'K', 'K', ]): | |
self.values = values | |
self.cards = cards | |
def totalCards(self): |
This file contains hidden or 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
# 0 | 1 | 2 | |
#---|---|--- | |
# 3 | 4 | 5 | |
#---|---|--- | |
# 6 | 7 | 8 | |
import os | |
class TicTacToe: | |
entries = "012345678"; | |
usedEntries = [None] * 9; |