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
if (typeof window.reform_loop == 'undefined') { | |
window.reform_loop = setInterval( | |
function nice_viewer() { | |
var vframe, pbox, fbox, tbox; | |
try { | |
vframe = document.querySelectorAll('.vframe')[0]; | |
pbox = vframe.querySelectorAll('.Preview')[0]; | |
fbox = vframe.querySelectorAll('.ReplyEditor__body')[0]; | |
tbox = fbox.getElementsByTagName('textarea')[0]; | |
try { |
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
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | |
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> | |
<script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script> | |
<div class="container"> | |
<div><h1>My First App</h1></div> | |
<input id="user_id" type="text"> | |
<button onclick="show_user()">Go</button> | |
<div id="user_area"></div> | |
</div> |
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
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | |
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> | |
<script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script> | |
<div class="container"> | |
<div><h1>My First App</h1></div> | |
<input id="user_id" type="text"> | |
<button onclick="gogo()">Go</button> | |
<div id="user_area"></div> | |
</div> |
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
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | |
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> | |
<script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script> | |
<div id="my_space"></div> | |
<script> | |
var user_info = null; | |
function get_user(user_id, callback) { | |
console.log('Send getAccounts request'); | |
steem.api.getAccounts([user_id], function(err, response){ |
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
// Run spawn as promised | |
function promised_spawn(cmd, args, option) { | |
let deferred = Q.defer(); | |
let watch = child_process.spawn(cmd, args, option); | |
watch.on('error', (error) => { | |
deferred.reject('encountered error ' + error.message); | |
}) | |
.on('exit', (code) => { | |
if (code !== 0) { | |
deferred.reject('exited with code ' + code); |
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
string convert(string s, int numRows) { | |
if (numRows == 0) return ""; | |
if (numRows == 1) return s; | |
vector<string> rows(numRows); | |
int row = 0; | |
int dir = -1; | |
for (int i = 0; i < s.size(); i++) { | |
rows[row].push_back(s[i]); | |
if (row == numRows - 1 || row == 0) { | |
dir = -dir; |
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
vector<int> plusOne(vector<int>& digits) { | |
if (digits.empty()) return digits; | |
bool overflow = true; | |
for (int i = 0; i < digits.size(); ++i) { | |
if (digits[i] != 9) { | |
overflow = false; | |
break; | |
} | |
} | |
int carry = 1; |
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
size_t edit_distance(const string& A, const string& B) | |
{ | |
size_t NA = A.size(); | |
size_t NB = B.size(); | |
vector<vector<size_t>> M(NA + 1, vector<size_t>(NB + 1)); | |
for (size_t i = 0; i <= NA; ++i) | |
M[i][0] = i; |
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
#ifndef __BIT_READER__H_ | |
#define __BIT_READER__H_ | |
#include <iostream> | |
#include <stdexcept> | |
#include <algorithm> | |
#include <cmath> | |
class BitReader { | |
const static unsigned char inbyte_mask[]; |