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
private void connectToUrl() { | |
System.out.println("Connecting to requested server"); | |
String[] requestLine = requestHeaders.get(0).split(" "); | |
String uri = requestLine[1]; | |
String method = requestLine[0]; | |
String domain = uri.substring(7, uri.length()); | |
int index = domain.indexOf("/"); | |
String hostname = domain.substring(0, index); | |
String directory = domain.substring(index, domain.length()); |
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
(load "functionParser.scm") | |
(load "environment.scm") | |
;(define call/cc call-with-current-continuation) | |
(define interpret | |
(lambda (filename) | |
(interpret-func-call 'main '() (interpret-global-stmt-list (parser filename) newenv)))) | |
(define interpret-global-stmt-list |
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
n = int(input()) | |
f = map(int,raw_input().split()) | |
print "YES" if len(f)==len(set(f)) else "NO" |
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
read({ prompt: 'Paste encrypted passwords file:'}, (err, encryptedText) => { | |
let decryptedText; | |
try { | |
decryptedText = decrypt(encryptedText, pwd); | |
} catch (e) { | |
return handleDecryptError(e); | |
} finally { | |
if (!decryptedText) return handleDecryptError(); | |
} |
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
'use strict'; | |
const read = require('read') | |
const CryptoJS = require("crypto-js"); | |
const handleReadErr = err => console.log(`Problem reading input.%n ${err}`); | |
const handleDecryptError = err => { | |
console.log(`Failed to decrypt text, probably the incorrect pwd.`); | |
if (err) console.log(err); | |
} |
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
testRpc.increaseTime = function(secondsToJump, cb) { | |
function send(method, params, callback) { | |
if (typeof params == "function") { | |
callback = params; | |
params = []; | |
} | |
provider.sendAsync({ | |
jsonrpc: "2.0", | |
method: method, |
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
uint private accept_payment; | |
function accept(string buyer_email) external payable { | |
accept_payment = msg.value; | |
buyer = msg.sender; | |
buyer_contact_information = buyer_email; | |
_setConversionRate(); | |
_changeState(ContractStates.Accepting); | |
} | |
function cancelAccept() external onlyBuyer { |
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
const util = require('util'); | |
const request = require('request-promise'); | |
const cheerio = require('cheerio'); | |
const imageDataURI = require('image-data-uri') | |
const _ = require('lodash'); | |
function getImgUris(urls) { | |
return Promise.all(urls.map(imageDataURI.encodeFromURL)); | |
} |
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
const getTag = (text, [lastParsedTag, lastParsedText] = [null, null]) => { | |
if (text.length === 0) return null; | |
const listItem = text[0] === '-'; | |
if (listItem) return 'li'; | |
const hashes = text.match(/^#+/); | |
if (hashes) return `h${Math.min(6, hashes[0].length)}`; | |
if (lastParsedTag === 'p' || lastParsedTag === 'li') return 'continued'; |
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
// Implement an EventManager class | |
// | |
// There should be three methods on this class: | |
// | |
// 1. subscribe(eventType: string, listener: Function) | |
// 2. unsubscribe(eventType: string, listener: Function) | |
// 3. publish(eventType: string, data: any) | |
// | |
// You can use either ES5 or ES6 notation |
OlderNewer