Skip to content

Instantly share code, notes, and snippets.

View sskylar's full-sized avatar
lgtm

Skylar SC sskylar

lgtm
View GitHub Profile
@sskylar
sskylar / category-loop1.html
Created April 13, 2017 19:49
Loop through a particular category (or tag) with Jekyll/Siteleaf
{% for post in site.posts %}
{% if post.categories contains 'Foo' %}
<li>{{ post.title }}</li>
{% endif %}
{% endfor %}
@sskylar
sskylar / _config.yml
Created April 12, 2017 17:45
Siteleaf/Jekyll post permalink with categories
defaults:
- scope:
path: ''
type: posts
values:
permalink: "/:categories/:title/"
@sskylar
sskylar / _includes-item.html
Created February 3, 2017 22:04
Recursive includes in Siteleaf / Jekyll
<li>{{ include.item.title }}
{% if include.item.items.size > 0 %}
<ul>
{% for item in include.item.items %}
{% include item.html item=item %}
{% endfor %}
</ul>
{% endif %}
</li>
@sskylar
sskylar / posts.json
Last active November 29, 2017 16:48
Output posts JSON feed using Jekyll / Siteleaf
---
---
[
{% for post in site.posts limit:10 %}
{
"title": {{ post.title | jsonify }},
"url": {{ post.url | jsonify }}
}
{% unless forloop.last %},{% endunless %}
{% endfor %}
@sskylar
sskylar / image-classes.markdown
Created December 31, 2016 03:21
Adding classes to images using metadata in Siteleaf/Jekyll
images
path class
/uploads/one.jpg
full
path class
/uploads/two.jpg
half

{% for image page.images %}

@sskylar
sskylar / extract-testflight.js
Last active January 28, 2017 19:36 — forked from mandyklingbeil/extract-testflight.js
Extract TestFlight user email addresses from iTunes Connect
//Make sure you scroll down to get all data loaded
var text = '';
$('.col-email').each(function(index,el) {
if (index == 0) {
text = 'Email, First Name, Last Name, Status, Date\n';
}
else {
//Email
text = text + $.trim($(el).find("a").text()) + ',';
//First Name
@sskylar
sskylar / _config.yml
Last active November 1, 2016 15:57
Custom nested menu for Jekyll/Siteleaf
menu:
- title: Home
url: /
- title: About
url: /about
children:
- title: Contact
url: /about/contact
- title: Team
url: /about/team
@sskylar
sskylar / _config.yml
Created October 24, 2016 18:49
Jekyll defaults with empty list
---
defaults:
- scope:
path: ''
type: posts
values:
list_with_placeholder: ["placeholder"]
empty_list: []
empty_object: {}
@sskylar
sskylar / tags.html
Last active January 26, 2021 13:40
Sort Jekyll tags by popularity (number of posts)
<ul>
{% capture tags %}
{% for tag in site.tags %}
<li data-sort="{{ site.posts.size | minus: tag[1].size | prepend: '0000' | slice: -4, 4 }}">
<a href="/{{ site.tag_page_dir }}/{{ tag[0] | slugify: 'pretty' }}">{{ tag[0] }} <span>{{ tag[1].size }}</span></a>
</li>
{% endfor %}
{% endcapture %}
{{ tags | split:'</li>' | sort | join:'</li>' }}
</ul>
@sskylar
sskylar / every-version-gem-install.sh
Created August 24, 2016 23:57
Install every version of a particular Ruby gem
for i in $(gem search '^GEMNAME$' --all \
| grep -o '\((.*)\)$' \
| tr -d '() ' \
| tr ',' "\n")
do
gem install GEMNAME -v $i --no-document
done