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
def visit_twitter_and_log_in | |
visit 'https://cards-dev.twitter.com/validator'📁 | |
find('input.js-username-field').set(ENV['TWITTER_USERNAME']) | |
find('input.js-password-field').set(ENV['TWITTER_PASSWORD']) | |
click_on('Log in') | |
end | |
def enter_url_and_click_preview(url) | |
find('input.FormControl').set(url) | |
click_on('Preview card') | |
result = has_content?('Page fetched successfully') |
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 EventEmitter = require('events').EventEmitter | |
class PrivateStateMachine { | |
constructor(sm, opts = {}) { | |
this.state = opts.state | |
Object.defineProperty(this, 'sm', { value: sm }) | |
Object.defineProperty(this, 'stateKey', { value: opts.stateKey || 'state' }) | |
this._setData(opts.data) | |
this._setStates(opts) | |
Object.defineProperty(this.sm, this.stateKey, { value: this.state, enumerable: true, configurable: 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
const http = require('http'), | |
url = require('url'), | |
fs = require('fs'), | |
path = require('path'), | |
port = process.env.PORT || 3000, | |
docroot = process.argv[2] || process.env.DOCROOT || '.', | |
log = console.log.bind(console) | |
http.createServer(function (req, res) { | |
log(`${ req.method } ${ req.url }`) |
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 DEBUG = true | |
// const DEBUG = process.env.NODE_ENV !== 'production' | |
const LOG_DATE = true | |
const LOG_LOCALE = "en-US" | |
const LOG_DATE_OPTS = { year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit', second: '2-digit' } | |
const log = function (level, ...args) { | |
if (DEBUG) { | |
let prefix = '' | |
if (typeof level === 'string' && [ 'log', 'warn', 'error' ].includes(level)) { |
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"; | |
class Calc { | |
constructor() { | |
this._setToBaseState(); | |
} | |
_setToBaseState() { | |
// find static methods at end of Calc class | |
this.__FIRST = "0"; |
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
version: "2" | |
networks: | |
default: | |
proxy: | |
services: | |
nginx: | |
restart: always | |
image: nginx:alpine |
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
pragma solidity ^0.4.19; | |
contract RequestForTruth { | |
address admin; | |
function RequestForTruth() public { | |
admin = msg.sender; | |
} | |
} |
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
<style> | |
input[type="file"]{ | |
position: absolute; | |
top: -500px; | |
} | |
div.file-listing{ | |
width: 200px; | |
} |
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
// This file is MIT Licensed. | |
// | |
// Copyright 2017 Christian Reitwiessner | |
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF O |
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 crypto = require('crypto'); | |
class MerkleTree { | |
constructor(value, depth, width) { | |
this.depth = depth; | |
this.width = width; | |
let nodes = depth * width; | |
let valueLength = Math.ceil(value.length / nodes); | |
let valueArray = this.generateArray(value, valueLength); |
NewerOlder