Skip to content

Commit c819b5e

Browse files
authored
Merge pull request #56 from epxlabs/blog-master
Blog master merge to master -- the final countdown
2 parents 912c600 + 6a8d385 commit c819b5e

28 files changed

+1206
-31
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pom.xml.asc
99
/.nrepl-port
1010
.hgignore
1111
.hg/
12+
env.clj
1213

1314
# Mac local-specific files
1415
.DS_Store

README.md

+33
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ A Clojure library designed to ... well, that part is up to you.
44

55
## Run Locally
66

7+
` bin/set_env.sh [STAGE]` (Either dev, staging, or production)
78
`lein ring server-headless`
89

910
The site can be reached in your browser at http://localhost:3000/
@@ -65,6 +66,38 @@ Super manual deploy (not recommended):
6566

6667
This will deploy to staging.epxlabs.com
6768

69+
## Editing HTML
70+
71+
To edit HTML files and see the changes immediately without rebooting your local server, navigate to `src/site-generator/snippets.clj` and use `M-x touch`
72+
73+
## Adding a Blog Post
74+
75+
Blog posts should be in markdown format and should be located in `resources/partials/blog-posts`. They should use the format `YEAR-MONTH-DATE-blog-title.markdown`.
76+
77+
You must generate a `src/site_generator/env.clj` file and insert your AWS credentials into it (this allows for S3 image upload to work). The file should look like the following:
78+
79+
```clojure
80+
(ns site-generator.env)
81+
82+
(def cred {:access-key "YOUR AWS ACCESS KEY", :secret-key "YOUR AWS SECRET KEY"})
83+
```
84+
85+
Additionally, you must add your blog_post to the blogs vector in `src/site_generator/snippets.clj` using the following format:
86+
87+
```clojure
88+
{:title "Your title"
89+
:date "Today's date"
90+
:author "Your name"
91+
:file-path "resources/partials/blog-posts/your-blog.markdown"}
92+
```
93+
94+
To add images to your blog post, place them in `resources/public/blog_images` and use the following markdown syntax:
95+
`![ALT-TEXT]~*FILE NAME*~`
96+
97+
Alt text should be whatever you want the name of the image to be when it is hovered over, and file name should be the exact name of the image file.
98+
99+
NOTE: the file name should just be the name of the file itself without the path. So, "your-image.jpg" instead of "resources/public/blog_images/your_image.jpg".
100+
68101
## License
69102

70103
Copyright © 2016 EPX Labs, Inc.

bin/deploy.sh

-1
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,4 @@ pushd $CURRENT_DIR/..
3838
aws s3 sync "${EXPORTED_VENDOR}/font-awesome/fonts" "${BASE_S3_URL}/vendor/font-awesome/fonts" --acl public-read
3939
aws s3 sync "${EXPORTED_VENDOR}/rs-plugin/fonts" "${BASE_S3_URL}/vendor/rs-plugin/fonts" --acl public-read
4040
aws s3 sync "${EXPORTED_VENDOR}/simple-line-icons/fonts" "${BASE_S3_URL}/vendor/simple-line-icons/fonts" --acl public-read
41-
4241
popd

bin/upload_images.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash -ex
2+
CURRENT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
3+
BLOG_IMAGES="resources/public/blog_images"
4+
BASE_S3_URL="s3://blog-images.epxlabs.com"
5+
aws s3 sync "${BLOG_IMAGES}/" "${BASE_S3_URL}/" --acl public-read

project.clj

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
:description "Generates epxlabs.com"
33
:url "https://github.com/epxlabs/site-generator"
44
:dependencies [[org.clojure/clojure "1.8.0"]
5+
[clj-aws-s3 "0.3.10"]
56
[clygments "0.1.1"]
67
[enlive "1.1.6"]
78
[me.raynes/cegdown "0.1.1"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!---
2+
layout: post
3+
title: "Welcome to Jekyll!"
4+
date: 2016-08-20 12:24:03 -0500
5+
categories: jekyll update
6+
published: false
7+
-->
8+
# Welcome to Jekyll!
9+
10+
You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
11+
12+
To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.
13+
14+
Jekyll also offers powerful support for code snippets:
15+
16+
``` ruby
17+
def print_hi(name)
18+
puts "Hi, #{name}"
19+
end
20+
print_hi('Tom')
21+
#=> prints 'Hi, Tom' to STDOUT.
22+
```
23+
24+
Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk].
25+
26+
[jekyll-docs]: http://jekyllrb.com/docs/home
27+
[jekyll-gh]: https://github.com/jekyll/jekyll
28+
[jekyll-talk]: https://talk.jekyllrb.com/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
<!---
2+
title: Setup Ruby On Rails on Ubuntu 14.10 Utopic Unicorn
3+
description: "A guide to setting up a Ruby on Rails development environment on Ubuntu 14.10 Utopic Unicorn"
4+
layout: blog_post
5+
categories: ubuntu
6+
-->
7+
8+
# Setup Ruby On Rails on Ubuntu 14.10 Utopic Unicorn
9+
10+
This will take about 30 minutes.
11+
12+
We will be setting up a Ruby on Rails development environment on Ubuntu 14.10 Utopic Unicorn.
13+
14+
The reason we're going to be using Ubuntu is because the majority of code you write will run on a Linux server. Ubuntu is one of the easiest Linux distributions to use with lots of documentation so it's a great one to start with.
15+
16+
You'll want to download the latest Desktop version here: http://releases.ubuntu.com/14.10/
17+
18+
Some of you may choose to develop on Ubuntu Server so that your development environment matches your production server. You can find it on the same download link above.
19+
Installing Ruby
20+
21+
The first step is to install some dependencies for Ruby.
22+
23+
sudo apt-get update
24+
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
25+
26+
Next we're going to be installing Ruby using one of three methods. Each have their own benefits, most people prefer using rbenv these days, but if you're familiar with rvm you can follow those steps as well. I've included instructions for installing from source as well, but in general, you'll want to choose either rbenv or rvm.
27+
28+
29+
Installing with rbenv is a simple two step process. First you install rbenv, and then ruby-build:
30+
31+
cd
32+
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
33+
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
34+
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
35+
exec $SHELL
36+
37+
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
38+
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
39+
exec $SHELL
40+
41+
rbenv install 2.3.1
42+
rbenv global 2.3.1
43+
ruby -v
44+
45+
The last step is to install Bundler
46+
47+
gem install bundler
48+
49+
rbenv users need to run rbenv rehash after installing bundler.
50+
Configuring Git
51+
52+
We'll be using Git for our version control system so we're going to set it up to match our Github account. If you don't already have a Github account, make sure to register. It will come in handy for the future.
53+
54+
Replace my name and email address in the following steps with the ones you used for your Github account.
55+
56+
git config --global color.ui true
57+
git config --global user.name "YOUR NAME"
58+
git config --global user.email "[email protected]"
59+
ssh-keygen -t rsa -b 4096 -C "[email protected]"
60+
61+
The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it here.
62+
63+
cat ~/.ssh/id_rsa.pub
64+
65+
Once you've done this, you can check and see if it worked:
66+
67+
68+
69+
You should get a message like this:
70+
71+
Hi excid3! You've successfully authenticated, but GitHub does not provide shell access.
72+
73+
## Installing Rails
74+
75+
Since Rails ships with so many dependencies these days, we're going to need to install a Javascript runtime like NodeJS. This lets you use Coffeescript and the Asset Pipeline in Rails which combines and minifies your javascript to provide a faster production environment.
76+
77+
To install NodeJS, we're going to add it using the official repository:
78+
79+
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
80+
sudo apt-get install -y nodejs
81+
82+
And now, without further adieu:
83+
84+
gem install rails -v 4.2.6
85+
86+
If you're using rbenv, you'll need to run the following command to make the rails executable available:
87+
88+
rbenv rehash
89+
90+
Now that you've installed Rails, you can run the rails -v command to make sure you have everything installed correctly:
91+
92+
rails -v
93+
# Rails 4.2.6
94+
95+
If you get a different result for some reason, it means your environment may not be setup properly.
96+
Setting Up MySQL
97+
98+
Rails ships with sqlite3 as the default database. Chances are you won't want to use it because it's stored as a simple file on disk. You'll probably want something more robust like MySQL or PostgreSQL.
99+
100+
There is a lot of documentation on both, so you can just pick one that seems like you'll be more comfortable with. If you're coming from PHP, you may already be familiar with MySQL. If you're new to databases, I'd suggest skipping to setting up PostgreSQL.
101+
102+
You can install MySQL server and client from the packages in the Ubuntu repository. As part of the installation process, you'll set the password for the root user. This information will go into your Rails app's database.yml file in the future.
103+
104+
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
105+
106+
Installing the libmysqlclient-dev gives you the necessary files to compile the mysql2 gem which is what Rails will use to connect to MySQL when you setup your Rails app.
107+
108+
When you're finished, you can skip to the Final Steps.
109+
110+
## Setting Up PostgreSQL
111+
112+
For PostgreSQL, we're going to add a new repository to easily install a recent version of Postgres.
113+
114+
sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
115+
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
116+
sudo apt-get update
117+
sudo apt-get install postgresql-common
118+
sudo apt-get install postgresql-9.5 libpq-dev
119+
120+
The postgres installation doesn't setup a user for you, so you'll need to follow these steps to create a user with permission to create databases. Feel free to replace chris with your username.
121+
122+
sudo -u postgres createuser chris -s
123+
124+
If you would like to set a password for the user, you can do the following
125+
126+
sudo -u postgres psql
127+
postgres=# \password chris
128+
129+
## Final Steps
130+
131+
And now for the moment of truth. Let's create your first Rails application:
132+
133+
#### If you want to use SQLite (not recommended)
134+
rails new myapp
135+
136+
#### If you want to use MySQL
137+
rails new myapp -d mysql
138+
139+
#### If you want to use Postgres
140+
# Note that this will expect a postgres user with the same username
141+
# as your app, you may need to edit config/database.yml to match the
142+
# user you created earlier
143+
rails new myapp -d postgresql
144+
145+
# Move into the application directory
146+
cd myapp
147+
148+
# If you setup MySQL or Postgres with a username/password, modify the
149+
# config/database.yml file to contain the username/password that you specified
150+
151+
# Create the database
152+
rake db:create
153+
154+
rails server
155+
156+
You can now visit [http://localhost:3000](http://localhost:3000) to view your new website!
157+
158+
Now that you've got your machine setup, it's time to start building some Rails applications.
159+
160+
If you received an error that said `Access denied for user 'root'@'localhost' (using password: NO)` then you need to update your config/database.yml file to match the database username and password.
161+
162+
163+
164+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<!---
2+
title: "Zsh: in the pursuit of efficiency"
3+
description: Zsh as part of development kit
4+
layout: blog_post
5+
categories: zsh
6+
-->
7+
8+
__Zsh__ - a very powerful advanced shell significantly increases your efficiency as its exploration.
9+
10+
## Zsh and iTerm2
11+
12+
We will use zsh in combination with [iTerm2](http://iterm2.com/features.html), as well as setup zsh completions using homebrew.
13+
14+
```clojure
15+
brew update
16+
brew tap caskroom/homebrew-cask
17+
brew install brew-cask
18+
brew cask install iterm2
19+
20+
brew install zsh zsh-completions
21+
echo "/usr/local/bin/zsh" | sudo tee -a /etc/shells
22+
chsh -s /usr/local/bin/zsh
23+
```
24+
25+
26+
## Oh My Zsh
27+
28+
Now let's setup framework "Oh My Zsh". It includes a lot of plugins and themes, allowing customize to suit every taste.
29+
30+
```clojure
31+
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
32+
```
33+
34+
35+
### Choose theme
36+
37+
We will use "agnoster" theme as example. For iTerm2 You need to download Solarized Dark:
38+
39+
```clojure
40+
git clone https://github.com/CyberLight/agnoster.zsh-theme
41+
```
42+
43+
Import Solarized Dark.itermcolors from previously downloaded archive.
44+
45+
*iTerm2 menu -> Preferences -> Profiles -> Colors -> Color Presets -> Import*
46+
47+
<img src="https://s3.amazonaws.com/blog-images.epxlabs.com/7/iterm_profiles_colors.png" width="600">
48+
49+
After import it should appear in list of presets:
50+
51+
<img src="https://s3.amazonaws.com/blog-images.epxlabs.com/7/iterm_profiles_colors_presets.png" width="200">
52+
53+
54+
#### Install fonts
55+
56+
Some themes, like "agnoster" in our case, need to install additional fonts. Run next script to do this:
57+
58+
```clojure
59+
git clone https://github.com/powerline/fonts.git
60+
cd fonts
61+
# next addresses could change. If so please check https://github.com/CyberLight/agnoster.zsh-theme
62+
mkdir -p others
63+
64+
fonts=('https://gist.github.com/qrush/1595572/raw/6c453ddc959b93895ffbf4fd904e2ba60256c904/Inconsolata-dz-Powerline.otf' \
65+
'https://gist.github.com/qrush/1595572/raw/6c453ddc959b93895ffbf4fd904e2ba60256c904/Menlo-Powerline.otf' \
66+
'https://gist.github.com/qrush/1595572/raw/6c453ddc959b93895ffbf4fd904e2ba60256c904/mensch-Powerline.otf' \
67+
'https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf' \
68+
)
69+
70+
for i in $fonts; do
71+
wget $i -P others/
72+
done
73+
./install.sh
74+
```
75+
76+
Change Font in iTerm2:
77+
78+
*iTerm2 menu -> Preferences -> Profiles -> Text -> Change Font (for Regular font and for Non-ASCII)*
79+
80+
<img src="https://s3.amazonaws.com/blog-images.epxlabs.com/7/iterm_profiles_text.png" width="600">
81+
82+
83+
#### Set theme and plugins
84+
85+
Update your ~/.zshrc with:
86+
87+
```clojure
88+
ZSH_THEME="agnoster"
89+
plugins=(git colored-man-pages colorize virtualenv pip python brew osx zsh-syntax-highlighting)
90+
```
91+
92+
Your current console should look like:
93+
94+
<img src="https://s3.amazonaws.com/blog-images.epxlabs.com/7/iterm_zsh_agnoster.png" width="600">

0 commit comments

Comments
 (0)