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
/* Hash Table */ | |
var hash = (string, max) => { | |
var hash = 0; | |
for (var i = 0; i < string.length; i++) { | |
hash += string.charCodeAt(i); | |
} | |
return hash % max; | |
}; |
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
/* LinkedList */ | |
function LinkedList() { | |
var length = 0; | |
var head = null; | |
var Node = function(element){ | |
this.element = element; | |
this.next = null; | |
}; |
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
/* Trie Data Structure */ | |
let Node = function() { | |
this.keys = new Map(); | |
this.end = false; | |
this.setEnd = function() { | |
this.end = true; | |
}; | |
this.isEnd = function() { | |
return this.end; |
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
/* Heaps */ | |
// left child: i * 2 | |
// right child: i * 2 + 1 | |
// parent: i / 2 | |
let MinHeap = function() { | |
let heap = [null]; | |
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
/* Graphs: Breadth-first search */ | |
function bfs(graph, root) { | |
var nodesLen = {}; | |
for (var i = 0; i < graph.length; i++) { | |
nodesLen[i] = Infinity; | |
} | |
nodesLen[root] = 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
/*1628393708,,JIT Construction: v1004222318,en_US*/ | |
/** | |
* Copyright (c) 2017-present, Facebook, Inc. All rights reserved. | |
* | |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | |
* copy, modify, and distribute this software in source code or binary form for use | |
* in connection with the web services and APIs provided by Facebook. | |
* | |
* As with any software that integrates with the Facebook platform, your use of |
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 React from "react"; | |
// Injects the Facebook SDK into the page | |
const injectFbSDKScript = () => { | |
(function (d, s, id) { | |
var js, | |
fjs = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) { | |
return; | |
} |
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 styled from 'styled-components' | |
export const CarouselContainer = styled.ul` | |
max-width: 1040px; | |
background: #0F1624; | |
padding: 0rem; | |
list-style:none; | |
display: flex; | |
justify-content: space-between; |
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
#!/usr/bin/python | |
# coding=utf-8 | |
# pashakun.com | |
#Import module | |
import os,sys,time,datetime,random,hashlib,re,threading,json,getpass,urllib,cookielib | |
from multiprocessing.pool import ThreadPool | |
try: | |
import mechanize | |
except ImportError: |
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
const crypto = require('crypto') | |
const get = require('simple-get') | |
const OAuth = require('oauth-1.0a') | |
const querystring = require('querystring') | |
const TW_REQ_TOKEN_URL = 'https://api.twitter.com/oauth/request_token' | |
const TW_AUTH_URL = 'https://api.twitter.com/oauth/authenticate' | |
const TW_ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token' | |
class LoginWithTwitter { |