Diff
-oldCode()
+newCode()
JavaScript
import { ApiPromise, WsProvider } from '@polkadot/api';
...
const wsProvider = new WsProvider('wss://rpc.polkadot.io');
const api = await ApiPromise.create({ provider: wsProvider });
console.log(api.genesisHash.toHex());
ApiPromise
.create({ provider: wsProvider }).isReady
.then((api) =>
console.log(api.genesisHash.toHex())
);
const api = new ApiPromise({ provider: wsProvider });
await api.isReady;
console.log(api.genesisHash.toHex());
Python
from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
INSTALLED_APPS = [
'polls.apps.PollsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
from django.db import models
class Question(models.Model):
def __str__(self):
return self.question_text
class Choice(models.Model):
def __str__(self):
return self.choice_text
import datetime
from django.db import models
from django.utils import timezone
class Question(models.Model):
def was_published_recently(self):
return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
Ruby
Rails.application.routes.draw do
root "articles#index"
get "/articles", to: "articles#index"
get "/articles/:id", to: "articles#show"
end
class ArticlesController < ApplicationController
def index
@articles = Article.all
end
def show
@article = Article.find(params[:id])
end
def new
@article = Article.new
end
def create
@article = Article.new(article_params)
if @article.save
redirect_to @article
else
render :new
end
end
private
def article_params
params.require(:article).permit(:title, :body)
end
end
class CommentsController < ApplicationController
def create
@article = Article.find(params[:article_id])
@comment = @article.comments.create(comment_params)
redirect_to article_path(@article)
end
private
def comment_params
params.require(:comment).permit(:commenter, :body)
end
end
module Visible
def archived?
status == 'archived'
end
end
C++
#include <iostream>
using namespace std;
typedef struct complex {
float real;
float imag;
} complexNumber;
complexNumber addComplexNumbers(complex, complex);
int main() {
complexNumber num1, num2, complexSum;
char signOfImag;
cout << "For 1st complex number," << endl;
cout << "Enter real and imaginary parts respectively:" << endl;
cin >> num1.real >> num1.imag;
cout << endl
<< "For 2nd complex number," << endl;
cout << "Enter real and imaginary parts respectively:" << endl;
cin >> num2.real >> num2.imag;
complexSum = addComplexNumbers(num1, num2);
signOfImag = (complexSum.imag > 0) ? '+' : '-';
complexSum.imag = (complexSum.imag > 0) ? complexSum.imag : -complexSum.imag;
cout << "Sum = " << complexSum.real << signOfImag << complexSum.imag << "i";
return 0;
}
complexNumber addComplexNumbers(complex num1, complex num2) {
complex temp;
temp.real = num1.real + num2.real;
temp.imag = num1.imag + num2.imag;
return (temp);
}
Solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.0 <0.9.0;
// State Variables
contract SimpleStorage {
uint storedData; // State variable
// ...
}
// Functions
contract SimpleAuction {
function bid() public payable { // Function
// ...
}
}
// Helper function defined outside of a contract
function helper(uint x) pure returns (uint) {
return x * 2;
}
// Function Modifiers
contract Purchase {
address public seller;
modifier onlySeller() { // Modifier
require(
msg.sender == seller,
"Only seller can call this."
);
_;
}
function abort() public view onlySeller { // Modifier usage
// ...
}
}
// Struct Types
contract Ballot {
struct Voter { // Struct
uint weight;
bool voted;
address delegate;
uint vote;
}
}
// Enum Types
contract Purchase {
enum State { Created, Locked, Inactive } // Enum
}
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Dora Research Blog</title>
<meta name="title" content="Dora Research Blog">
<meta name="description" content="Dora Research Blog">
<meta name="keywords" content="doraresearch,dora,research,testbench,prototype,ui,design,playground">
<meta name="viewport" content="width=device-width, viewport-fit=cover,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-title" content="Dora Research">
<meta name="theme-color" content="#110920">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="shortcut icon" href="./assets/favicon.ico?v=0.1.0">
<link rel="icon" sizes="16x16 24x24 32x32 48x48 64x64" href="./assets/favicon.ico?v=0.1.0">
<link rel="icon" sizes="128x128" href="./assets/favicon-128.png?v=0.1.0">
<link rel="icon" sizes="192x192" href="./assets/favicon-192.png?v=0.1.0">
<link rel="icon" sizes="196x196" href="./assets/favicon-196.png?v=0.1.0">
<link rel="apple-touch-icon" href="./assets/favicon-180.png?v=0.1.0">
<link rel="apple-touch-icon" sizes="120x120" href="./assets/favicon-120.png?v=0.1.0">
<link rel="apple-touch-icon" sizes="152x152" href="./assets/favicon-152.png?v=0.1.0">
<link rel="apple-touch-icon" sizes="167x167" href="./assets/favicon-167.png?v=0.1.0">
<link rel="apple-touch-icon" sizes="180x180" href="./assets/favicon-180.png?v=0.1.0">
<meta name="msapplication-TileColor" content="#110920">
<meta name="msapplication-TileImage" content="./assets/favicon-144.png">
<meta name="application-name" content="❤︎">
<meta name="msapplication-tooltip" content="❤︎">
<meta name="msapplication-config" content="./assets/ieconfig.xml">
<link rel="preload" href="./assets/IBMPlexSans-Text.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="./assets/IBMPlexSans-TextItalic.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="./assets/IBMPlexSans-SemiBold.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="./assets/IBMPlexSans-SemiBoldItalic.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="./assets/IBMPlexSans-Bold.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="./assets/IBMPlexSans-BoldItalic.woff2" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" href="./assets/highlight-theme.css?v=0.1.0">
<link rel="stylesheet" href="./assets/app.css?v=0.1.0">
<meta name="generator" content="Hexo 5.4.0">
</head>
<body class="index">
<main class="grid-main" role="main">
<header class="index-brand brand">
<h1 class="brand-main">Dora Research <span class="brand-sub">Blog</span>
</h1>
</header>
<section class="index-toc toc">
<ul class="toc-list">
<li class="toc-item">
<div class="toc-metadata">
<p class="toc-date">
<time datetime="2021-10-17T00:00:00.000Z">17 Oct 2021</time>
</p>
<p class="toc-author">Eric Zhang</p>
</div>
<h3 class="toc-title">
<a href="./2021/10/17/decentralize-the-hacker-movement/">Decentralize The Hacker Movement</a>
</h3>
</li>
<li class="toc-item">
<div class="toc-metadata">
<p class="toc-date">
<time datetime="2020-12-14T00:00:00.000Z">14 Dec 2020</time>
</p>
<p class="toc-author">Eric Zhang</p>
</div>
<h3 class="toc-title">
<a href="./2020/12/14/quadratic-voting-funding/">二次方投票和二次方资助</a>
</h3>
</li>
</ul>
</section>
<nav class="index-category aside-category">
<h5 class="aside-caption">Category</h5>
<ul class="aside-category-list">
<li class="aside-category-item">
<a href="/category/hackathon-dao/">Hackathon DAO</a>
</li>
<li class="aside-category-item">
<a href="/category/governance/">Governance</a>
</li>
<li class="aside-category-item">
<a href="/category/economics/">Economics</a>
</li>
<li class="aside-category-item">
<a href="/category/blockchain/">Blockchain</a>
</li>
<li class="aside-category-item">
<a href="/category/hackerlink/">HackerLink</a>
</li>
<li class="aside-category-item">
<a href="/category/quadratic-funding/">Quadratic Funding</a>
</li>
<li class="aside-category-item">
<a href="/category/continuous-funding/">Continuous Funding</a>
</li>
<li class="aside-category-item">
<a href="/category/daorayaki/">DAOrayaki</a>
</li>
<li class="aside-category-item">
<a href="/category/english/">English</a>
</li>
<li class="aside-category-item">
<a href="/category/chinese/">中文</a>
</li>
</ul>
</nav>
<footer class="index-copyright aside-copyright">
<p class="aside-copyright-info">Copyright © 2021</p>
</footer>
</main>
<script type="text/javascript" src="./assets/app.js?v=0.1.0"></script>
</body>
</html>
Less
@ink-main : hsla(260, 55%, 8%, 1);
@ink-sub : hsla(260, 55%, 8%, 0.57);
@ink-line : hsla(260, 55%, 8%, 0.1);
@bg-main : hsla(260, 55%, 100%, 1);
@accent : hsla(260, 95%, 52.5%, 1);
@accent-p3 : ~"color(display-p3 0.343 0.1002 0.9378)";
@font-face {
font-family: 'IBM Plex Sans';
font-style: normal;
font-weight: 400;
font-display: fallback;
src: url("IBMPlexSans-Text.woff2") format("woff2"), url("IBMPlexSans-Text.woff") format("woff");
}
@font-face {
font-family: 'IBM Plex Sans';
font-style: italic;
font-weight: 400;
font-display: fallback;
src: url("IBMPlexSans-TextItalic.woff2") format("woff2"), url("IBMPlexSans-TextItalic.woff") format("woff");
}
@font-en: "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
@font-zh: "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
@regular : 400;
@semibold: 600;
@bold : 700;
@emsize : 18px;
@leading : 28px;
@emsize-sub : 14px;
@leading-sub: 21px;
@zIndex-0: 0;
@zIndex-1: 100;
@zIndex-2: 200;
@zIndex-3: 300;
@zIndex-4: 400;
@zIndex-5: 500;
@zIndex-6: 600;
@zIndex-7: 700;
@zIndex-8: 800;
@zIndex-9: 900;
@bp-mobile : 600px;
@bp-desktop : 1600px;
@bp-desktop--s: 1200px;
.line-halfpx--vert() {
width : 1px;
height : unset;
background-size : 100% 1px;
background-image: linear-gradient(
to right,
@ink-main 0%,
@ink-main 51%,
transparent 51%
);
}
.line-halfpx--hori() {
width : unset;
height : 1px;
background-size : 100% 1px;
background-image: linear-gradient(
to bottom,
@ink-main 0%,
@ink-main 51%,
transparent 51%
);
}
.glass-nav() {
background-color: fadeout(@bg-main, 20%);
backdrop-filter : blur(24px);
}
.pseduo-navbar() {
&::before {
content : "";
position: fixed;
z-index : @zIndex-4;
top : 0;
left : 0;
right : 0;
height : 42px;
.glass-nav();
}
&::after {
content : "";
position: fixed;
z-index : @zIndex-5;
top : 42px;
left : 24px;
right : 0;
.line-halfpx--hori();
}
}
.cat main {
grid-template-rows : minmax((@leading * 5.5), auto) auto;
row-gap : 0;
padding-bottom : (@leading * 6);
@media (max-width: @bp-mobile) {
padding-bottom: 0;
.pseduo-navbar();
}
}
.cat-copyright {
grid-column-start: 1;
grid-column-end : 4;
grid-row-start : 1;
grid-row-end : 2;
}
@media (max-width: @bp-mobile) {
.cat main {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.cat-copyright {
margin-top: auto;
}
}
.cat-brand {
grid-column-start: 4;
grid-column-end : 10;
grid-row-start : 1;
grid-row-end : 2;
@media (max-width: 360px) {
.brand-sub {
display: none;
}
}
}
.cat-toc {
grid-column-start: 4;
grid-column-end : 10;
grid-row-start : 2;
grid-row-end : 3;
}
.cat-category {
grid-column-start: 11;
grid-column-end : 13;
grid-row-start : 1;
grid-row-end : 3;
@media (max-width: @bp-mobile) {
.cat-category-heading {
display: none;
}
.aside-caption::before {
content : attr(data-active);
letter-spacing: 0;
text-transform: none;
}
}
}
Markdown
# Donec et eros eu est rhoncus hendrerit
## Nunc eget dui rutrum, posuere risus at, hendrerit odio
### Mauris id nisl sed tortor rutrum efficitur
Lorem ipsum dolor sit amet, consectetur adipiscing elit.[^1] Proin mi nisl, egestas in justo at, porta finibus elit. Sed sit amet mi nibh. Quisque eleifend erat a nibh sodales, sit amet porta mauris scelerisque. Vivamus non dignissim nisl. Nunc in fringilla diam. Cras quam mi, consequat et risus eget, rhoncus sagittis leo[^2]. Maecenas fermentum sollicitudin ultricies. Nulla non nisl ac est pharetra elementum. Donec a massa libero. Aenean imperdiet in erat vitae feugiat. Cras turpis nulla, ullamcorper ornare efficitur dapibus, venenatis eget massa. Quisque dictum finibus ligula rutrum malesuada.
> Sed aliquet ultricies nulla, *nec faucibus massa* ultricies sodales. Maecenas lobortis felis congue congue semper. Aliquam rutrum lectus ac sapien consectetur pharetra.
>
> Phasellus maximus quam ac blandit hendrerit. Cras condimentum accumsan nulla, sed tempus lorem blandit nec. Mauris mauris[^3] mauris, sagittis vel iaculis vel, cursus ac nulla. Duis quis consectetur nunc. Donec id sollicitudin lorem. Aliquam **aliquet purus urna**, vel dictum purus porta nec.
Aliquam erat volutpat. Curabitur lacinia justo eget luctus vestibulum. Phasellus consectetur tincidunt tellus a dignissim. In eget orci nulla. Praesent non feugiat mauris. Integer posuere, dolor nec maximus placerat, nisi elit tincidunt mauris, viverra interdum massa tellus at quam. Nulla et lectus ac odio ultrices finibus blandit eu turpis. Pellentesque leo nulla, vestibulum sit amet porttitor in, ultrices quis velit. Maecenas non ipsum quis urna lacinia mattis. In dictum metus nibh, ac venenatis justo mattis et. Suspendisse ut erat arcu. Integer at mi fermentum, ornare velit eget, pharetra purus.
# Nullam eu nisl posuere, tempor tortor quis, auctor dui
Aliquam scelerisque vehicula dui, ornare pellentesque sapien condimentum a. Duis pulvinar condimentum urna quis egestas. Integer auctor hendrerit tincidunt. Vestibulum elit dui, congue vel scelerisque in, cursus nec mi. Maecenas felis urna, volutpat ac justo sed, aliquam tempor felis. Sed sollicitudin felis et eros aliquet venenatis. Proin vitae neque laoreet, blandit quam ut, vestibulum tortor. Suspendisse volutpat dolor quis purus imperdiet vulputate. Maecenas vitae tincidunt nibh, eu mollis sapien. Pellentesque a neque sit amet ex mattis ultrices at ac nulla. Nullam vitae nunc id augue tincidunt viverra ac in mi. Cras turpis leo, maximus non rhoncus quis, finibus id massa. Sed metus urna, euismod et justo eget, facilisis sollicitudin tortor. Donec fermentum molestie ante ut varius. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin laoreet risus tempor orci blandit, ac sodales augue tristique.
## Vivamus tincidunt nulla quis vestibulum auctor
Aenean molestie auctor elementum. Donec a lorem nunc. Phasellus tempor dui a massa ornare lobortis. Aliquam malesuada tellus eu diam euismod pellentesque. Nullam enim orci, facilisis id porta iaculis, consectetur sed lectus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Aliquam nec ex est. Vestibulum quis nibh nisl. Curabitur egestas lorem ut fermentum aliquet. Morbi velit dui, vestibulum sit amet interdum nec, gravida vehicula arcu. Quisque faucibus est vitae fermentum volutpat. Fusce blandit sapien sed velit rutrum, at dictum velit blandit. Integer purus nulla, dapibus nec eros quis, dictum finibus libero. Mauris vitae elit nisi. Etiam nec tellus sit amet lectus vestibulum placerat quis non eros.
### In mollis eros at lorem auctor, vel aliquet quam semper.
Morbi aliquet ultricies odio, ac tristique magna varius nec. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed neque neque, porta nec fringilla consectetur, feugiat non est. Etiam id neque a ipsum euismod sodales eget in enim. Cras massa nibh, faucibus nec semper a, euismod in nunc. Praesent pulvinar erat leo, ut vestibulum nisl pharetra quis. In in lorem fringilla, elementum sem nec, consectetur elit. Integer condimentum cursus elementum. Mauris dolor nulla, facilisis quis ligula ac, tempor tempus sapien.
#### Phasellus tincidunt eros sed felis varius, sit amet euismod quam gravida
Fusce dapibus venenatis rhoncus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non blandit risus, quis semper dui. Pellentesque malesuada ligula ipsum, ac efficitur dolor pharetra ac. Vestibulum lorem eros, euismod vel dictum ut, tempor vulputate justo. Nam finibus posuere velit at tincidunt. Morbi egestas in massa eu scelerisque. Aenean lacus nibh, porttitor quis tempor ac, venenatis at dui. Vivamus lacinia tortor magna, ut posuere arcu aliquam vitae.
##### Curabitur rutrum dui sed nisl consectetur euismod
Sed a tellus venenatis, mattis ex quis, tincidunt leo. Duis vitae sapien vitae arcu volutpat placerat elementum sed lacus. Vivamus vel gravida massa. Vestibulum feugiat nisi sit amet neque placerat, in lobortis odio mollis. Aenean et felis mauris. Mauris ut ipsum at nunc fermentum semper ornare eget turpis. Aliquam a laoreet augue, nec aliquet sapien. Maecenas vehicula, ipsum sed luctus faucibus, leo ipsum bibendum purus, eget aliquam eros ipsum maximus nisl. Duis lacinia, magna maximus ultrices egestas, diam lectus aliquam purus, molestie scelerisque nunc sem sit amet enim. Proin finibus blandit consequat. Morbi feugiat ex eget ligula consectetur, ullamcorper convallis ipsum aliquet. In augue enim, hendrerit ultricies porta nec, tempor sed dolor. Etiam eget dictum lacus.
###### Suspendisse bibendum turpis sit amet volutpat congue
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam erat volutpat. Mauris ullamcorper ante eget porttitor porta. Fusce accumsan eros quis nisi egestas, non fringilla nisi pellentesque. Nunc gravida dolor eu orci commodo dapibus. Nunc egestas arcu quis sapien pharetra, at commodo ipsum auctor. Sed eget mollis turpis. Duis vulputate, tortor id cursus consequat, velit lorem cursus erat, eget bibendum neque eros nec justo. Praesent euismod lorem hendrerit lacus semper tempor. Quisque ut feugiat ante, nec eleifend libero. Ut egestas efficitur elementum. Praesent malesuada est risus, vitae facilisis quam accumsan a. Quisque ex orci, consectetur sed neque nec, tempor auctor enim.
![cHackathon (<i>illust by L&Q</i>)](https://doraresearch-design.laerhsif.com/data/post-fig-1.png "Fig. 1: cHackathon")
Duis posuere metus tempor venenatis convallis. Donec condimentum commodo massa id euismod. Suspendisse tempus maximus turpis, et facilisis sapien consectetur eu. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis vel ultrices turpis. Mauris ac nisi eget nibh lobortis finibus vitae ut leo. Cras sed viverra sapien, at tempor risus. Nullam rhoncus ante quis dui sollicitudin interdum. Sed lobortis, lectus at pharetra tincidunt, est turpis lobortis libero, nec maximus tortor eros ut erat. Etiam quis pulvinar erat. Curabitur eleifend augue nec leo molestie ultrices ac sit amet turpis. Integer bibendum massa ac est malesuada, quis sagittis metus convallis. Mauris sollicitudin elit eu felis luctus tristique.
[^1]: Donec luctus lectus in nunc placerat viverra.
[^2]: Duis semper augue ac bibendum pretium.
[^3]: Quisque in nisi tincidunt, sollicitudin leo nec, sollicitudin justo.