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 / example.css
Created July 11, 2012 02:29
Symbolset Examples
.cf{zoom:1;}.cf:before,.cf:after{content:"";display:table;}.cf:after{clear: both;}
[id^="example-"] [class^="ss-"]:before {
padding-right: 0.5em;
}
[id^="example-"], [id^="example-"] button {
font-family: Helvetica, sans-serif;
font-size: 16px;
line-height: 1.5;
@sskylar
sskylar / background.html
Created November 13, 2012 16:01
Symbolset as background
<style>
.ss-book { font-size: 18px; text-decoration: none; position: relative; color: black; }
.ss-book:before { font-size: 80px; position: absolute; left: -16px; top: -36px; color: #ccc;}
.ss-book .text { position: relative; z-index: 1; }
</style>
<a href="#" class="ss-book"><span class="text">Books</span></a>
@sskylar
sskylar / .htaccess
Last active December 13, 2015 20:48
Protect SS files from hotlinking
RewriteCond "%{HTTP_HOST}_%{HTTP_REFERER}" "!\.?([^\.]+\.[^\.]+?)_https?://.*\1/.*$" [OR]
RewriteCond %{HTTP_REFERER} ^$
RewriteRule ss-[a-zA-Z0-9-]+\.(woff|eot|ttf|svg|js|css)$ - [F,NC,L]
@sskylar
sskylar / import-siteleaf.json
Last active December 18, 2015 18:10
Siteleaf import script. Imports a JSON dump of blog posts into a Siteleaf page. Requires the Siteleaf Gem (https://github.com/siteleaf/siteleaf-gem). Run in the command line using "ruby import-siteleaf.rb".
[{
"title":"Post 1",
"body":"Body goes here.",
"tags":["Tag 1", "Tag 2"],
"slug":"post-1",
"published_at":"2013-06-05T18:24:59-04:00"
}, {
"title":"Post 2",
"body":"Body goes here.",
"tags":["Tag 1", "Tag 2"],
@sskylar
sskylar / jekyll-siteleaf.rb
Last active December 18, 2015 19:39
Jekyll to Siteleaf import script.Imports posts from Jekyll into a Siteleaf page, retains markdown and converts frontmatter into metadata/taxonomy. Requires the Siteleaf Gem (https://github.com/siteleaf/siteleaf-gem).Save to your Jekyll site folder and run in the command line using "ruby jekyll-siteleaf.rb".
require "siteleaf"
require "yaml"
# API settings
Siteleaf.api_key = '...'
Siteleaf.api_secret = '...'
# site settings
site_id = '...'
page_id = '...' # blog page to import posts into
@sskylar
sskylar / siteleaf-git-hook
Last active December 18, 2015 23:29
Siteleaf Git hook, pushes theme changes to Siteleaf on `commit` or `push`. Name file `.git/hooks/pre-commit` for commit hook, or `.git/hooks/pre-push` for push hook (push hook available in Git 1.8.2+). Make sure to add file execute permissions in order for this to work.
#!/bin/sh
echo "Pushing Siteleaf theme..."
siteleaf push theme
<div>
<h3 style="border-top:1px dashed #ccc;margin-top:1em;padding-top:1em">BOX_HEADLINE</h3>
BOX_LINKLIST_IMAGE
</div>
@sskylar
sskylar / posts.json.liquid
Created September 19, 2013 16:25
Siteleaf JSON
{{ site.posts | json }}
require 'fog'
def benchmark(connection, dir, n)
path = connection.directories.get(dir)
timers = []
n.times do
folder = SecureRandom.hex.to_s
start = Time.now
file = path.files.create(
@sskylar
sskylar / minify-liquid.html
Last active January 8, 2021 19:00
Simple HTML minify with Liquid/Siteleaf. Strips all line breaks, tabs, and extra spaces.
{% capture html %}
<html>
...
</html>
{% endcapture %}{{ html | strip_newlines | replace:' ','' | replace:' ','' | replace:' ',' ' }}