forked from rigoneri/syte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0b53240
Showing
54 changed files
with
4,281 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.pyc | ||
.DS_Store |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: gunicorn syte.wsgi -b 0.0.0.0:$PORT |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Syte | ||
|
||
A easy to setup and deploy personal site that has social integrations like tumblr, twitter, github and dribble. | ||
|
||
|
||
## Instructions | ||
|
||
TODO!! | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
|
||
if __name__ == "__main__": | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "syte.settings") | ||
|
||
from django.core.management import execute_from_command_line | ||
|
||
execute_from_command_line(sys.argv) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Django==1.4 | ||
certifi==0.0.8 | ||
chardet==1.0.1 | ||
httplib2==0.7.4 | ||
oauthlib==0.1.3 | ||
pyasn1==0.1.3 | ||
requests==0.12.1 | ||
rsa==3.0.1 | ||
wsgiref==0.1.2 | ||
psycopg2==2.4.5 | ||
gunicorn==0.14.2 | ||
-e git://github.com/brosner/python-oauth2.git#egg=oauth2 |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
import os | ||
import sys | ||
import subprocess | ||
import shlex | ||
import traceback | ||
|
||
path_to_here = os.path.abspath(os.path.dirname(__file__)) | ||
path_before_site = path_to_here[0:path_to_here.rfind('syte')] | ||
sys.path.append(path_before_site) | ||
os.environ['DJANGO_SETTINGS_MODULE'] = 'syte.settings' | ||
|
||
from django.conf import settings | ||
|
||
def compress_statics(): | ||
compress_styles() | ||
compress_js() | ||
|
||
def compress_styles(): | ||
less_path = 'static/less/styles.less' | ||
css_path = 'static/css/' | ||
|
||
try: | ||
subprocess.check_call(shlex.split('lessc {0} {1}styles-{2}.min.css -yui-compress' | ||
.format(less_path, css_path, settings.COMPRESS_REVISION_NUMBER))) | ||
print 'CSS Styles Generated: styles-{0}.min.css'.format(settings.COMPRESS_REVISION_NUMBER) | ||
except Exception: | ||
exc_type, exc_value, exc_traceback = sys.exc_info() | ||
stack_trace = traceback.format_exception(exc_type, exc_value, exc_traceback) | ||
print stack_trace | ||
|
||
def compress_js(): | ||
js_files = [ | ||
'libs/jquery.url.js', | ||
'libs/require.js', | ||
'libs/handlebars.js', | ||
'libs/moment.min.js', | ||
'libs/bootstrap-modal.js', | ||
'libs/spin.min.js', | ||
|
||
'components/base.js', | ||
'components/mobile.js', | ||
'components/blog-posts.js', | ||
'components/links.js', | ||
] | ||
|
||
if settings.TWITTER_INTEGRATION_ENABLED: | ||
js_files.append('components/twitter.js') | ||
|
||
if settings.GITHUB_INTEGRATION_ENABLED: | ||
js_files.append('components/github.js') | ||
|
||
if settings.DRIBBBLE_INTEGRATION_ENABLED: | ||
js_files.append('components/dribbble.js') | ||
|
||
combined = '' | ||
for js in js_files: | ||
f = open('static/js/' + js, 'r') | ||
combined += f.read() | ||
f.close() | ||
|
||
f = open('static/js/combined.js', 'w') | ||
f.write(combined) | ||
f.close() | ||
|
||
try: | ||
subprocess.check_call(shlex.split('uglifyjs -o static/js/min/scripts-{0}.min.js static/js/combined.js'.format(settings.COMPRESS_REVISION_NUMBER))) | ||
subprocess.check_call(shlex.split('rm -f static/js/combined.js')) | ||
print 'JavaScript Combined and Minified: scripts-{0}.min.js'.format(settings.COMPRESS_REVISION_NUMBER) | ||
except Exception: | ||
exc_type, exc_value, exc_traceback = sys.exc_info() | ||
stack_trace = traceback.format_exception(exc_type, exc_value, exc_traceback) | ||
print stack_trace | ||
|
||
if __name__ == "__main__": | ||
compress_statics() | ||
sys.exit() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
from django.conf import settings | ||
|
||
def site_pages(request): | ||
context = dict() | ||
if settings.DEPLOYMENT_MODE == 'dev': | ||
context['DEV_DEPLOYMENT_MODE'] = True | ||
|
||
context['COMPRESS_REVISION_NUMBER'] = settings.COMPRESS_REVISION_NUMBER | ||
context['MEDIA_URL'] = settings.MEDIA_URL | ||
|
||
context['TWITTER_INTEGRATION_ENABLED'] = settings.TWITTER_INTEGRATION_ENABLED | ||
context['GITHUB_INTEGRATION_ENABLED'] = settings.GITHUB_INTEGRATION_ENABLED | ||
context['DRIBBBLE_INTEGRATION_ENABLED'] = settings.DRIBBBLE_INTEGRATION_ENABLED | ||
|
||
return context |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Django settings for syte project. | ||
|
||
import os | ||
import django | ||
# calculated paths for django and the site | ||
# used as starting points for various other paths | ||
DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__)) | ||
SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
DEBUG = True | ||
TEMPLATE_DEBUG = DEBUG | ||
|
||
ADMINS = ( | ||
# ('Your Name', 'your_email@example.com'), | ||
) | ||
MANAGERS = ADMINS | ||
|
||
|
||
TIME_ZONE = 'America/Chicago' | ||
LANGUAGE_CODE = 'en-us' | ||
SITE_ID = 1 | ||
USE_I18N = False | ||
USE_L10N = False | ||
USE_TZ = True | ||
|
||
MEDIA_ROOT = os.path.join(SITE_ROOT, 'static') | ||
|
||
SECRET_KEY = '5c^pml#7e3d$zor%*_7y098(l0i=d3$+y_((11-_j0&f9rw9%)' | ||
|
||
TEMPLATE_LOADERS = ( | ||
'django.template.loaders.filesystem.Loader', | ||
'django.template.loaders.app_directories.Loader', | ||
) | ||
|
||
MIDDLEWARE_CLASSES = ( | ||
'django.middleware.common.CommonMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
) | ||
|
||
ROOT_URLCONF = 'syte.urls' | ||
|
||
WSGI_APPLICATION = 'syte.wsgi.application' | ||
|
||
TEMPLATE_DIRS = ( | ||
os.path.join(SITE_ROOT, 'templates') | ||
) | ||
|
||
TEMPLATE_CONTEXT_PROCESSORS = ( | ||
"django.core.context_processors.debug", | ||
"django.core.context_processors.media", | ||
"django.core.context_processors.request", | ||
"django.contrib.messages.context_processors.messages", | ||
"syte.context_processor.site_pages", | ||
) | ||
|
||
INSTALLED_APPS = ( | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.sites', | ||
'django.contrib.messages', | ||
'gunicorn', | ||
) | ||
|
||
from syte_settings import * |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//Global configs and functions shared between js | ||
|
||
function numberWithCommas(x) { | ||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); | ||
} | ||
|
||
require.config({ | ||
baseUrl: "/static/", | ||
paths: { | ||
"text": "js/libs/text", | ||
"json": "js/libs/json" | ||
}, | ||
waitSeconds: 15 | ||
}); | ||
|
||
var spin_opts = { | ||
lines: 9, | ||
length: 5, | ||
width: 2, | ||
radius: 4, | ||
rotate: 9, | ||
color: '#4c4c4c', | ||
speed: 1.5, | ||
trail: 40, | ||
shadow: false, | ||
hwaccel: false, | ||
className: 'spinner', | ||
zIndex: 2e9 | ||
}; | ||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
|
||
function fetchBlogPosts() { | ||
require(["json!/blog.json", "text!templates/blog-post.html" ], | ||
function(blog_posts, post_template) { | ||
var template = Handlebars.compile(post_template); | ||
|
||
$('.loading').remove(); | ||
$.each(blog_posts.response.posts, function(i, p) { | ||
p.formated_date = moment(p.date).format('MMMM DD, YYYY') | ||
$('#blog-posts').append(template(p)); | ||
}); | ||
|
||
setupLinks(); | ||
setTimeout(setupBlogHeaderCells, 1000); | ||
adjustSelection('home-link'); | ||
}); | ||
} | ||
|
||
function setupBlogHeaderCells() { | ||
|
||
if(isMobileView) | ||
return; | ||
|
||
var previousTarget, | ||
activeTarget, | ||
$window = $(window), | ||
offsets = [], | ||
targets = [], | ||
$posts = $('.blog-section article hgroup h3 a').each(function() { | ||
if (this.hash) { | ||
targets.push(this.hash); | ||
offsets.push($(this.hash).offset().top); | ||
} | ||
}); | ||
|
||
function processScroll(e) { | ||
var scrollTop = $window.scrollTop(), | ||
i = offsets.length; | ||
|
||
for (i; i--;) { | ||
if (activeTarget != targets[i] && scrollTop > offsets[i] && (!offsets[i + 1] || scrollTop < offsets[i + 1])) { | ||
//set current target to be absolute | ||
$("h3 a[href=" + activeTarget + "]").removeClass("active").css({ | ||
position: "absolute", | ||
top: "auto" | ||
}); | ||
|
||
//set new target to be fixed | ||
activeTarget = targets[i]; | ||
$("h3 a[href=" + activeTarget + "]").attr('style', '').addClass("active"); | ||
} | ||
|
||
if (activeTarget && activeTarget != targets[i] && scrollTop + 50 >= offsets[i] && (!offsets[i + 1] || scrollTop + 50 <= offsets[i + 1])) { | ||
// if it's close to the new target scroll the current target up | ||
$("h3 a[href=" + activeTarget + "]") | ||
.removeClass("active") | ||
.css({ | ||
position: "absolute", | ||
top: $(activeTarget).outerHeight(true) + $(activeTarget).offset().top + 90 + "px", | ||
bottom: "auto" | ||
}); | ||
} | ||
|
||
if (activeTarget == targets[i] && scrollTop > offsets[i] - 50 && (!offsets[i + 1] || scrollTop <= offsets[i + 1] - 50)) { | ||
// if the current target is not fixed make it fixed. | ||
if (!$("h3 a[href=" + activeTarget + "]").hasClass("active")) { | ||
$("h3 a[href=" + activeTarget + "]").attr('style', '').addClass("active"); | ||
} | ||
} | ||
} | ||
} | ||
|
||
$posts.click(function(e) { | ||
if (!this.hash) | ||
return; | ||
$('html, body').stop().animate({ | ||
scrollTop: $(this.hash).offset().top | ||
}, 500, 'linear'); | ||
|
||
processScroll(); | ||
e.preventDefault(); | ||
}); | ||
|
||
$window.scroll(processScroll).trigger("scroll"); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
function setupDribbble(url, el) { | ||
var href = el.href; | ||
|
||
if ($('#dribbble-profile').length > 0) { | ||
window.location = href; | ||
return; | ||
} | ||
|
||
var params = url.attr('path').split('/').filter(function(w) { | ||
if (w.length) | ||
return true; | ||
return false; | ||
}) | ||
|
||
if (params.length == 1) { | ||
var username = params[0]; | ||
|
||
var spinner = new Spinner(spin_opts).spin(); | ||
$('#dribbble-link').append(spinner.el); | ||
|
||
require(["json!/dribbble/" + username, "text!templates/dribbble-view.html"], | ||
function(dribbble_data, dribbble_view) { | ||
if (dribbble_data.message || dribbble_data.length == 0) { | ||
window.location = href; | ||
return; | ||
} | ||
|
||
var template = Handlebars.compile(dribbble_view); | ||
|
||
var user = dribbble_data.shots[0].player; | ||
user.following_count = numberWithCommas(user.following_count); | ||
user.followers_count = numberWithCommas(user.followers_count); | ||
user.likes_count = numberWithCommas(user.likes_count); | ||
|
||
var template_data = { | ||
"user": user, | ||
"shots": dribbble_data.shots | ||
} | ||
|
||
$(template(template_data)).modal().on('hidden', function () { | ||
$(this).remove(); | ||
adjustSelection('home-link'); | ||
}) | ||
|
||
spinner.stop(); | ||
}); | ||
|
||
return; | ||
} | ||
|
||
window.location = href; | ||
} |
Oops, something went wrong.