Skip to content

Commit

Permalink
project init
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnrisgao committed Sep 18, 2017
0 parents commit 664348a
Show file tree
Hide file tree
Showing 366 changed files with 142,516 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016 PyConChina

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 OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# PyConChina2016
The official website of PyCon China 2016, 基于 [https://github.com/PyConChina/staticpycon](https://github.com/PyConChina/staticpycon)

## Dev

```
npm install uglify-js -g
sudo gem install sass
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
```

开发模式(监控变化):

```
source venv/bin/activate
./bin/app.py -s
```
1 change: 1 addition & 0 deletions asset/js/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// base.js
21 changes: 21 additions & 0 deletions asset/js/menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
$(document).ready(function () {
// fix menu when passed

$('.masthead').visibility({
once: false,
onBottomPassed: function () {
$('.fixed.menu').transition('fade in');
},
onBottomPassedReverse: function () {
$('.fixed.menu').transition('fade out');
}
});

// create sidebar and attach to menu open
$('.ui.sidebar').sidebar('attach events', '.toc.item');

$('.ui.menu .ui.dropdown').dropdown({
on: 'hover'
});

});
1 change: 1 addition & 0 deletions asset/js/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// utils.js
160 changes: 160 additions & 0 deletions asset/sass/base.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
// TODO: 从 CSS 切换成 SCSS
.hidden.menu {
display: none;
}

.masthead.segment {
min-height: 500px;
padding: 1em 0em;
/*background-image: url(https://cosmicjs.com/uploads/0e5a4fd0-5abc-11e6-8f51-55bd82b62d3b-cosmic-js-dark.jpg) !important;*/
/*background-image: url(http://ocgxshkaw.bkt.clouddn.com/bg2.jpg) !important;*/
/*background-image: url(http://ocgxshkaw.bkt.clouddn.com/bg5.jpg) !important;*/
background-image: url(http://ocgxshkaw.bkt.clouddn.com/bg6.jpg) !important;
background-size: cover !important;
background-position: center !important;
color: #fff !important;
overflow: hidden !important;
}
.masthead .logo.item img {
margin-right: 1em;
}
.masthead .ui.menu .ui.button {
margin-left: 0.5em;
}
.masthead h1.ui.header {
margin-top: 1.5em;
margin-bottom: 0em;
font-size: 4em;
font-weight: normal;
}
.masthead h2 {
font-size: 1.7em;
font-weight: normal;
}
.ui.vertical.stripe {
padding: 4em 0em;
}
.ui.vertical.stripe h3 {
font-size: 2em;
}
.ui.vertical.stripe .button + h3,
.ui.vertical.stripe p + h3 {
margin-top: 3em;
}
.ui.vertical.stripe .floated.image {
clear: both;
}
.ui.vertical.stripe p {
font-size: 1.33em;
}
.ui.vertical.stripe .horizontal.divider {
margin: 3em 0em;
}

.quote.stripe.segment {
padding: 0em;
}
.quote.stripe.segment .grid .column {
padding-top: 5em;
padding-bottom: 5em;
}

.footer.segment {
padding: 4em 0em;
}

.secondary.pointing.menu .toc.item {
display: none;
}

.ui.link.cards.speakers {
margin-left: auto;
margin-right: auto;

img {
height: 290px !important;
}
}


.ui.center.aligned.header.speakers {
margin-bottom: 1.5em;
}

.ui.center.aligned.header.sponsors {
margin-top: 1.0em;
margin-bottom: 1.0em;
}

.ui.images.sponsors img {
filter: gray;
-webkit-filter: grayscale(100%);
-webkit-backface-visibility: hidden;
}
.ui.images.sponsors img:hover {
filter: none;
-webkit-filter: none;
-webkit-backface-visibility: hidden;
}

.ui.center.aligned.header.pythoners {
margin-bottom: 1.0em;
}

.ui.container.pythoners a {
margin-top: 0.5em;
}

.ui.center.aligned.header.schedule {
margin-bottom: 1.0em;
}

.ui.container .middle.aligned.content {
text-align: left;
}


@media only screen and (max-width: 700px) {
.ui.fixed.menu {
display: none !important;
}
.secondary.pointing.menu .item,
.secondary.pointing.menu .menu {
display: none;
}
.secondary.pointing.menu .toc.item {
display: block;
}
.masthead.segment {
min-height: 350px;
}
.masthead h1.ui.header {
font-size: 2em;
margin-top: 1.5em;
}
.masthead h2 {
margin-top: 0.5em;
font-size: 1.5em;
}
}

.ui.header.volunteers {
margin-bottom: 1.0em;
}

.ui.link.cards.volunteers {
margin-left: auto;
margin-right: auto;

img {
height: 290px !important;
}
}

.pycon-odd-seg {

}

.pycon-even-seg {
background-color: #f2f3f4 !important;
}
46 changes: 46 additions & 0 deletions bin/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import print_function

from multiprocessing import Process
import os
import sys
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import TCPServer

import click

from staticpycon import utils, gen


def do_serve():
print('Listening on 0.0.0.0:8080 ...\n')
TCPServer.allow_reuse_address = True
server = TCPServer(('0.0.0.0', 8080), SimpleHTTPRequestHandler)
os.chdir(gen.SITE_DIR)
server.serve_forever()


@click.command()
@click.option('--debug', '-d', is_flag=True, default=False,
help=u'调试模式下不合并/压缩 Assets')
@click.option('--generate', '-g', is_flag=True, default=False,
help=u'生成站点')
@click.option('--serve', '-s', is_flag=True, default=False,
help=u'启动本地server')
def run(debug, generate, serve):
utils.init_logger()

if generate and serve:
print(u'--generate和--serve不能同时使用')
sys.exit(1)

if serve:
Process(target=do_serve).start()

gen.create_site(debug=debug, use_reloader=serve, generate=generate)


if __name__ == '__main__':
run()
Empty file added bin/staticpycon/__init__.py
Empty file.
26 changes: 26 additions & 0 deletions bin/staticpycon/_colorama_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-

from __future__ import unicode_literals

__all__ = [
'colorama',
]


try:
import colorama
except ImportError:
# just stub out ANSI control codes
class colorama(object):
class Style(object):
DIM = RESET_ALL = ''

class Fore(object):
BLACK = RED = GREEN = YELLOW = BLUE = MAGENTA = CYAN = WHITE = ''
RESET = ''

@staticmethod
def init():
pass

# vim:set ai et ts=4 sts=4 fenc=utf-8:
16 changes: 16 additions & 0 deletions bin/staticpycon/cachebuster.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-

from __future__ import unicode_literals

import time


def gen_cachebuster_qs():
'''生成可直接附着在静态资源 URL 之后的 cachebuster query string.
内容即为构建开始时间的 Unix 时间戳.
'''
return '?_t={}'.format(int(time.time()))


# vim:set ai et ts=4 sts=4 fenc=utf-8:
Loading

0 comments on commit 664348a

Please sign in to comment.