Skip to content

Instantly share code, notes, and snippets.

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());
(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
n = int(input())
f = map(int,raw_input().split())
print "YES" if len(f)==len(set(f)) else "NO"
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();
}
'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);
}
testRpc.increaseTime = function(secondsToJump, cb) {
function send(method, params, callback) {
if (typeof params == "function") {
callback = params;
params = [];
}
provider.sendAsync({
jsonrpc: "2.0",
method: method,
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 {
@danielyaa5
danielyaa5 / scrapeSteem.js
Created September 26, 2017 05:39
Steemit Scraper
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));
}
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';
// 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