Skip to content

Instantly share code, notes, and snippets.

[*0..10].reverse.each{|i| puts i}
10.step(0, -1){|i| puts i}
(-10..0).each{|i| i *= -1; puts i}
r = (10..0)
(r.first).downto(r.last).each{|i| puts i}
A
AE
AED
AF
AFN
AL
ALL
AM
AMD
AN
#!/bin/sh
if [ ! -d "$1" -o ! -f "$1/Gemfile" ]; then
echo Usage `basename $0` /path/to/app [command... ]
exit 1
fi
PATH=$HOME/.rvm/bin:$PATH
APP_DIR=$(cd $1 && pwd)
APP_NAME=`basename $APP_DIR`
# -*- coding: utf-8 -*-
# referred to
# http://thesteve.org/technoblarg/2011/10/01/square-thumbnails-with-minimagick/
require 'mini_magick'
module MiniMagick
class Image
def self.square(src, dst, size)
thumb = open src
thumb.square dst, size
#!/bin/bash
#
# referred to
# http://www.stopdropandrew.com/2010/06/01/where-unicorns-go-to-die-watching-unicorn-workers-with-monit.html
#
if test -z "$RACK_ENV"; then
RACK_ENV=production
fi
if test -f ~/.rvm/scripts/rvm -o "$(type -t rvm)" = "function"; then
source ~/.rvm/scripts/rvm
# -*- coding: utf-8 -*-
require 'jekyll'
require 'flickraw'
require 'fileutils'
module Jekyll
class GeneratePhotosets < Generator
safe true
priority :low
---
title: 第5話 死体置き場にもう一人  
layout: layout
photoset: XXXXXXXXXXXXXXXXX
---
{% if page.photoset %}
<div class="gallery">
{% for photo in page.photos %}
<a href="{{ photo.medium_source }}">
<img src="{{ photo.square_source }}" width="{{ photo.square_width }}" height="{{ photo.square_height }}" />
</a>
{% endfor %}
</div>
{% endif %}
$ gem install flickraw
$ cd /path/to/jekyll
$ ruby _plugins/flickr.rb
flickr:
enabled: true
api_key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
shared_secret: "xxxxxxxxxxxxxxxx"
auth_token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
secret: "xxxxxxxxxxxxxxxx"
cache_dir: /tmp/jekyll/flickr