Skip to content

Commit 4227be5

Browse files
committed
blog start
1 parent ad3b640 commit 4227be5

18 files changed

+3590
-2
lines changed

blog/Blog.class.php

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
class Blog
4+
{
5+
protected static $slugMap = [];
6+
7+
public static function getPosts()
8+
{
9+
$posts = [];
10+
foreach(glob(ROOT_DIR.'/blog/posts/*.md') as $file)
11+
{
12+
$posts[] = Post::fromFile($file);
13+
}
14+
return $posts;
15+
}
16+
17+
public static function getPost($slug)
18+
{
19+
static::initSlugMap();
20+
if (isset(static::$slugMap[$slug]) && is_readable(static::$slugMap[$slug]))
21+
{
22+
return Post::fromFile(static::$slugMap[$slug]);
23+
}
24+
return null;
25+
}
26+
27+
public static function getSlugFromFilename($filename)
28+
{
29+
return strtolower(preg_replace('#^\d+\-#', '', basename(trim($filename), '.md')));
30+
}
31+
32+
protected static function initSlugMap()
33+
{
34+
if (!static::$slugMap)
35+
{
36+
foreach(glob(ROOT_DIR.'/blog/posts/*.md') as $file)
37+
{
38+
static::$slugMap[static::getSlugFromFilename($file)] = $file;
39+
}
40+
}
41+
}
42+
43+
public static function getSlugMap()
44+
{
45+
static::initSlugMap();
46+
return static::$slugMap;
47+
}
48+
}

blog/Post.class.php

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
class Post
4+
{
5+
protected $slug, $title, $author, $date, $contentHtml;
6+
7+
public static function fromFile($filename)
8+
{
9+
list($ignored, $frontMatter, $content) = explode('---', file_get_contents($filename), 3);
10+
return new static(Blog::getSlugFromFilename($filename), Spyc::YAMLLoadString(trim($frontMatter)), trim($content));
11+
}
12+
13+
public function __construct($slug, $frontMatter, $markdown)
14+
{
15+
$this->slug = $slug;
16+
$this->title = isset($frontMatter['title']) ? $frontMatter['title'] : null;
17+
$this->author = isset($frontMatter['author']) ? $frontMatter['author'] : null;
18+
$this->date = isset($frontMatter['date']) ? new DateTime($frontMatter['date']) : null;
19+
$this->contentHtml = ParsedownExtra::instance()->text(trim($markdown));
20+
}
21+
22+
public function getSlug()
23+
{
24+
return $this->slug;
25+
}
26+
27+
public function getTitle()
28+
{
29+
return $this->title;
30+
}
31+
32+
public function getAuthor()
33+
{
34+
return $this->author;
35+
}
36+
37+
public function getDate()
38+
{
39+
return $this->date;
40+
}
41+
42+
public function getContentHtml()
43+
{
44+
return $this->contentHtml;
45+
}
46+
47+
public function getPrevPostSlug()
48+
{
49+
$slugs = array_keys(Blog::getSlugMap());
50+
$key = array_search($this->getSlug(), $slugs);
51+
return $key === false || $key === 0 ? null : $slugs[$key-1];
52+
}
53+
54+
public function getNextPostSlug()
55+
{
56+
$slugs = array_keys(Blog::getSlugMap());
57+
$key = array_search($this->getSlug(), $slugs);
58+
return $key === false || $key >= count($slugs)-1 ? null : $slugs[$key+1];
59+
}
60+
}

blog/posts/01-the-lbry-opens.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
date: 2015-05-24
3+
author: jeremy
4+
title: The LBRY Opens
5+
---
6+
7+
Hello, world.
8+
9+
It's just Jimmy and me here at the front desk. Our little library is lonely.
10+
11+
Before it gets too crowded, some exposition is in order.
12+
13+
For as long as preserved knowledge has existed, people have collected it. And once you start collecting it, well, you'll need some way to
14+
keep it in order. LBRY is the next evolution of a desire as ancient as knowledge itself: to organize and access information.
15+
16+
However, if I ask you to imagine a library, you probably do not imagine a private archive of cuneiform tablets. Instead, you imagine a
17+
public library. The earliest library of this form was created by [the Junto](http://en.wikipedia.org/wiki/Junto_%28club%29), an 18th century
18+
discussion club founded by Benjamin Franklin. Their company sold shares to access their collection materials, and used that money to buy more books.
19+
[They still exist today](http://www.librarycompany.org/).
20+
21+
Franklin's library existed in a time where information was intrinsically scarce. Not only did each book have to be printed, but books faced
22+
expensive shipping costs from London.
23+
24+
In today's world, information does not face these constraints. Technology makes information as abundant as air or water. So why is it still
25+
so scarce?
26+
27+
We think it's scarce because people other than the creators and the consumers are in control.
28+
29+
We think it's scarce because corporations and governments conspire to keep it that way.
30+
31+
We think it's scarce because there is no Junto of the 21st century.
32+
33+
At least, not yet.
34+
35+
LBRY is the next evolution of Franklin's library. Join us in putting more information in the hands of the people and more money in the hands
36+
of creators.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: As Reddit Burns, It Powers The World
3+
author: jeremy
4+
date: 2015-06-11
5+
---
6+
7+
As part of a company, [LBRY](https://lbry.io), that cares passionately about the freedom of information (in both the beer and information sense), I find myself incapable of keeping my mouth shut about what's going on at [reddit.com](http://reddit.com/).
8+
9+
Yesterday, reddit.com [announced](https://www.reddit.com/r/announcements/comments/39bpam/removing_harassing_subreddits/) that they were banning five communities on the grounds of harassment.
10+
11+
Today, these are the top 10 posts on /r/all:
12+
13+
![The top posts of /r/all](http://i.imgur.com/RhFZDgs.png)
14+
15+
Perhaps my favorite internet moment ever has been given the indecently bland Wikipedia title of [AACS encryption key controversy](http://en.wikipedia.org/wiki/AACS_encryption_key_controversy). For the kids, non-nerds, and amnesiac nerds, a synopsis: the movie industry subpoenaed Digg to remove any references to the number **09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0** on the grounds that the number could be used to decrypt DVDs. Digg complied. Users revolted. The front page of Digg looked a lot like /r/all, except full of hexidecimal digits instead of fat people and swastikas.
16+
17+
Watching the everyman rebel against censorship and control brought tears to my eyes. It was an absolute inspiration. Astute eyes can find a tiny free speech flag in [our footer](https://lbry.io/why).
18+
19+
Calling Ellen Pao a Nazi and posting pictures of fat people has not made me cry.
20+
21+
---
22+
23+
Aaron Swartz and Alexis Ohanian are two of the three people given credit for creating Reddit.
24+
25+
I never met Aaron Swartz but I've read most of his blog. He seems honest, brilliant, open-minded and thoughtful. He passes the Fitzgerald test for a first-rate intelligence with flying colors.
26+
27+
Even more important than his words, I've seen what he did. Attempting to share JSTOR with the world was a beautiful thing. It puts him in the ranks of Manning, Snowden, Ulbricht, and other modern martyrs. While reasonable people may disagree with some of their actions, no reasonable person can disagree that following your conscience at personal expense to yourself is tremendous. On the balance, the world would be a far better place if everyone acted this way.
28+
29+
I have met Alexis Ohanian, briefly. I have read Without Their Permission. Alexis' words aren't bad. He encourages entrepreneurship, attacking problems, and improving the world. He also encourages going around those who would protect the entrenched, obstinate, and broken status quo.
30+
31+
When I met Alexis a few years ago, I had the chance to ask him a question. I asked him something like: if you believe in idea of routing around the rotten, why not put more energy into projects like that? Why not put resources into projects like Tor, Bitcoin, Bittorrent, or other technology that does the things he describes?
32+
33+
Alexis, at first, faltered. Then he gave me an answer about how there are difficult choices to make and it's important to work from within and from without. It wasn't a terrible answer, but it was a politician's answer. In those first few seconds I saw the mask drop. I saw a man's mind spinning a way to justify his true motivations: status and power. Those motivations are not inherently objectionable, but hypocrisy is.
34+
35+
Alexis Ohanian is not Aaron Swartz. Swartz did what was right, regardless of consequence. Ohanian does what has good consequences for him, then comes up with a way for it to be right.
36+
37+
Reddit claims that the grounds for the bans is violation of rules regarding the harassment of individuals. Like Alexis' words, this is commendable. However, we must always compare words and acts. When they contrast, we have found hypocrisy. We have found evil.
38+
39+
- Reddit [claims that it cares about transparency](http://www.reddit.com/r/announcements/comments/35uyil/transparency_is_important_to_us_and_today_we_take/), but refuses to provide any details or guidelines on its rules. Nor will it provide specific examples of the grounds on which it banned the targeted communities.
40+
41+
- Reddit claims it banned communities on grounds of targeted harassment, but users that have sited numerous specific examples of harassment from communities more politically favorable to Reddit's founders go ignored.
42+
43+
- Reddit claims that it banned the communities on grounds of targeted harassment, but has banned new subs created by unrelated users that have done no harassing.
44+
45+
- Reddit refuses to admit that advertising or public perception has anything to do with its actions. It insists that it is only about harassment.
46+
47+
- Reddit claims that it is about "authentic conversations" and unrestricted speech, but has hired a CEO, Ellen Pao, who represents [the antithesis of those values](http://fortune.com/2015/06/05/ellen-paos-appeal-is-now-about-the-money/).
48+
49+
Reddit is truly an Ohanian company.
50+
51+
I've neglected to mention the second half of the title. It's an old joke, made by many. Let's go with the SMBC version:
52+
53+
![SMBC 2011 November 12th](http://www.smbc-comics.com/comics/20111112.gif)
54+
55+
I hope someone has a generator hooked to Aaron Swartz right now.
+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: 5 Questions About LBRY
3+
author: jeremy
4+
date: 2015-07-01
5+
---
6+
7+
As I recently traveled across Europe, and ultimately to PorcFest, I took time to talk to talk to entrepreneurs, technologists, and libertarians about LBRY. For the mutualistic education of myself and others, below are the questions and answers to five frequently asked questions.
8+
9+
## Five Questions
10+
11+
### 1. When will LBRY come out?
12+
13+
As we recently Tweeted, we're extremely close to releasing a POC client:
14+
15+
To make sure you hear as soon as it is available, join our mailing list below or follow us.
16+
17+
Join Mailing List
18+
19+
Email Address
20+
21+
Subscribe
22+
23+
### 2. What happens if someone uploads infringing content to LBRY?
24+
25+
LBRY changes the way information is shared. LBRY's decentralized nature makes it impossible for LBRY Inc. to control any information published to the LBRY network. LBRY Inc. cannot censor or remove content from the network.
26+
27+
That said, a user who initially uploads infringing content to the LBRY network may be liable for civil or criminal copyright infringement under their local laws. A patron who accesses infringing content via the LBRY network may also be liable for copyright infringement. LBRY Inc. strongly encourages creators to refrain from publishing content which may infringe upon copyright and urges patrons to wait for authorized providers to source content.
28+
29+
Additionally, we've designed LBRY to protect miners and hosts. Content about information, or metadata, is stored in the LBRY blockchain and is required in the production of LBRY credits. Hosts only store tiny pieces of encrypted information, so they never have knowledge of their content nor, from a technical perspective, do they possess it. However, we are not your lawyers and this is neither legal advice nor a promise.
30+
31+
### 3. If LBRY is Bitcoin + Bittorrent, why does it not use the Bitcoin blockchain?
32+
33+
We spent a lot of time debating whether it was possible to build LBRY on top of Bitcoin. We certainly wanted to, as Bitcoin offers a tremendous user base.
34+
35+
Ultimately, we decided this was not possible to do. We want LBRY to be the most efficient market for selling and buying information. From a fundamental perspective, kludging LBRY ontop of Bitcoin would result in reduced efficiency.
36+
37+
We are huge believers in Bitcoin and recognize we would not be here without it. If we have seen further, it is by standing on the shoulders of anonymous giants. For this reason, we plan to commit a significant initial portion of LBRY credits to Bitcoin holders.
38+
39+
We will also be releasing the source of LBRY so that others may stand upon us.
40+
41+
### 4. What's the difference between LBRY and MaidSafe (or X)?
42+
43+
There are several attempts to build a decentralized computing platform. LBRY is not one of them; it exists only for information. Products that subsume the information problem, such as MaidSafe or Ethereum, will crumble under their own weight at the worst and not approach LBRY's performance at their best. Building an information delivery network inside of a larger decentralized platform is guaranteed at a fundamental level to result in worse performance, greater expense, or both.
44+
45+
Other crypto-data solutions are about providing reliable and known data-access methods for publishers (i.e. they give you a name, frequently gibberish, and attempt to promise that data will remain available at that name). LBRY is about creating best experience for consumers, who care less if names change than if a name gives them the information they desire.
46+
47+
LBRY's reservation-based approach to names means is unlike any other existing solution. We've leveraged Nobel Prize-winning economics to create a system in which names are extremely likely to resolve to what user's desire as well as be owned by the proper content creator. Greater user experience + greater creator experience = WNNNG1.
48+
49+
1 New LBRY policy: when disemvoweling, aim for maximum confusion.
50+
51+
### 5. Allowing anyone to bid a higher price for a name is insane|brilliant.
52+
53+
First, for clarity, here is LBRY's naming system as succinctly as possible:
54+
55+
whoever pledges the most credits against a name holds it, subject to a defined window for a counter-bid
56+
57+
Our instinctual desire to have confident possession of our property makes LBRY's resveration-only name system feel off. However, it has strong economic underpinnings. Famed economist Ronald Coase made the insight that as long as property rights are clearly defined and there are sufficiently low transaction costs, an efficient outcome will result regardless of the initial allocation of property.
58+
59+
First, let's ensure the premises to our theorem hold. In LBRY, property rights could not be more explicit - whoever has committed the most credits holds the name. Second, transaction costs are close to zero.
60+
61+
In the sense of this theorem, the efficient outcome is that the owner of any name will be the entity for whom the name holds the most value. When does a name hold the most value? When it maps to content that is most desired by users.
62+
63+
What do users desire when accessing a name? For a name to resolve to the content they envisioned as well as for that content to be provided by it's legitimate creator. The former desire may outstrip the latter, but consumers would clearly rather pay a legitimate creator than a non-legitimate creator. Thus, the legitimate content creator has maximal incentive to provide a LBRY name mapping to their content.
64+
65+
The end result of LBRY's reservation scheme is two-fold: 1) names will almost always resolve to what user's desire and 2) content creators will economically benefit from publishing content via LBRY.
66+
67+
## What No One Said
68+
69+
Exposing even a straightforward creation to the public is daunting. LBRY, with several machinating, interlocking parts, is straightforward's antipode. In these first days, with our bare shelves, understanding the edifice we are building requires the ability to make acute insights. Particularly with LBRY's naming scheme, it vears into the imposing Kingdom of the Counter Intuitive.
70+
71+
Despite this, no one said "I don't get it" or "you're crazy". Some people certainly got it faster than others, but everyone saw the need and the opportunity. People were excited. While we'll admit our early testing grounds are favorable (tech groups and a liberty festivals), the reaction has been equally favorable. Every interaction leaves us more inspired to create the most egalitarian, efficient library the world has ever seen.
72+
73+
LBRY Screenshot
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Meet the LBRY Founders
3+
author: jeremy
4+
date: 2015-07-28
5+
---
6+
7+
Here about LBRY straight from the horse's mouth. If there were two horses, that is. And the horses had created a revolutionary system for distributing information.
8+
9+
<iframe width="770" height="433" src="https://www.youtube.com/embed/0fDrBROywZ0" frameborder="0" allowfullscreen style="margin-left: auto; margin-right: auto"></iframe>

bootstrap.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

33
define('ROOT_DIR', __DIR__);
4+
date_default_timezone_set('Etc/UTC');
45

56
include ROOT_DIR . '/autoload.php';

controller/Controller.class.php

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public static function execute($uri)
5858
case '/lbry-linux-latest.deb':
5959
return static::redirect('https://s3.amazonaws.com/files.lbry.io/linux/lbry_0.2.1_amd64.deb', 307);
6060
default:
61+
if (preg_match('#^/blog($|/)#', $uri))
62+
{
63+
return BlogActions::execute($uri);
64+
}
6165
$noSlashUri = ltrim($uri, '/');
6266
if (View::exists('page/' . $noSlashUri))
6367
{
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
class BlogActions extends Actions
4+
{
5+
public static function execute($uri)
6+
{
7+
$slug = preg_replace('#^/blog(/|$)#', '', $uri);
8+
if ($slug)
9+
{
10+
return static::executePost($slug);
11+
}
12+
return static::executeHome();
13+
}
14+
15+
public static function executeHome()
16+
{
17+
$posts = Blog::getPosts();
18+
$page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
19+
return ['blog/home', [
20+
'posts' => $posts,
21+
'page' => $page
22+
]];
23+
}
24+
25+
public static function executePost($slug)
26+
{
27+
$post = Blog::getPost($slug);
28+
if (!$post)
29+
{
30+
return ['page/404', []];
31+
}
32+
return ['blog/post', [
33+
'post' => $post
34+
]];
35+
}
36+
}

0 commit comments

Comments
 (0)