Skip to content

Instantly share code, notes, and snippets.

@kerotaa
kerotaa / mnpp-dav.sh
Last active December 18, 2015 02:08
add WebDav modules to nginx for MNPP
#!/bin/sh
PCRE_URL='http://downloads.sourceforge.net/project/pcre/pcre/8.32/'
PCRE_FILE='pcre-8.32'
NGINX_URL="http://nginx.org/download/"
NGINX_FILE="nginx-1.2.8"
SRC_DIR="/Applications/MNPP/src"
@kerotaa
kerotaa / remove-empty-lines-html.rb
Last active May 26, 2020 03:48
A plugin that remove empty lines from HTML files on jekyll.
module Jekyll
module Convertible
def write(dest)
path = destination(dest)
FileUtils.mkdir_p(File.dirname(path))
if File.extname(path).downcase == '.html' then
self.output.strip!
reg = /<\/?pre[^>]*>/i
pres = self.output.scan(reg)
tary = self.output.split(reg)
@kerotaa
kerotaa / slug2name.rb
Created June 16, 2013 12:44
A filter that converts category slug to display name.
module Jekyll
module Slug2Name
def slug2name(input)
slug = @context.registers[:site].config['category_slugs'][input]
slug ? slug : input
end
end
end
Liquid::Template.register_filter(Jekyll::Slug2Name)
@kerotaa
kerotaa / md-code-block-highlight.rb
Last active December 18, 2015 13:48
A plugin that converts code blocks to highlight tag in markdown.
module Jekyll
module Convertible
alias :origin_render_liquid :render_liquid
def render_liquid(content, payload, info)
content.gsub!(/(?:^|\n)```(\w*)\n(.*?\n)```\n/m) do |text|
$1.empty? ? text : "\n{% highlight #{$1} %}\n#{$2}{% endhighlight %}"
end
origin_render_liquid(content, payload, info)
end
end
-- Settings
set timezone to "+09:00"
set postdir to "Macintosh HD:Users:kerotaa:Sites:kerotaa.github.com:_posts"
set editor to "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
-- Get Date
set dt to (current date)
on date_to_iso(dt)
set {year:y, month:m, day:d} to dt
@kerotaa
kerotaa / minify_html.rb
Created August 22, 2013 10:13
a jekyll plugin that compress html files
require 'html_press'
module Jekyll
module Convertible
def write(dest)
path = destination(dest)
FileUtils.mkdir_p(File.dirname(path))
if File.extname(path).downcase == '.html' then
self.output = HtmlPress.press self.output
end
module Jekyll
module Convertible
def write(dest)
path = destination(dest)
FileUtils.mkdir_p(File.dirname(path))
if File.extname(path).downcase == '.html' then
self.output.strip!
reg = /<\/?pre[^>]*>/i
pres = self.output.scan(reg)
tary = self.output.split(reg)
@kerotaa
kerotaa / AddEvenSpacingAlign.jsx
Last active December 21, 2015 18:08
A Photoshop Script that add selected layers and groups even spacing which you inputted.
#target photoshop
app.bringToFront();
(function(global) {
if (!documents.length) return;
function getSelectedLayers() {
var layers, gL, desc11, ref9, ref10;
layers = [];
#target photoshop
app.bringToFront();
(function(global) {
if (!documents.length) return;
function getSelectedLayers() {
var layers, gL, desc11, ref9, ref10;
layers = [];
@kerotaa
kerotaa / throttle
Created September 13, 2013 06:51
easy throttle
function throttle(fn, interval) {
var timer = null;
return function() {
var self = this, args = arguments;
if (!timer) {
timer = setTimeout(function() {
timer = null;
fn.apply(self, args);
}, interval);
}