Skip to content

Instantly share code, notes, and snippets.

View kozyty's full-sized avatar

Taiyo Kojima kozyty

  • SMS
  • Japan
View GitHub Profile
@kozyty
kozyty / Thorfile
Created January 19, 2017 06:00
Create a template with thor
require 'thor'
class Generator < Thor::Group
include Thor::Actions
argument :name
class_option :username, aliases: '-u', required: true
class_option :domain, aliases: '-d'
@kozyty
kozyty / dragonfly.rb
Created April 1, 2016 10:01
config/initiaizers/dragonfly.rb
require 'dragonfly'
require 'dragonfly/s3_data_store'
Dragonfly.app.configure do
plugin :imagemagick
secret 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
## :sha をformatに入れておくことで、query stringにならない
url_format "/media/:job/:sha/:name"
@kozyty
kozyty / file0.txt
Created October 7, 2015 02:20
ローカル環境へのSSH接続時にパスワードなしにしたい ref: http://qiita.com/kozyty@github/items/476fac50c97c9ded4c67
1. ssh-keygen -t rsa
2. cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
3. chmod og-wx ~/.ssh/authorized_keys
@kozyty
kozyty / OrderedBehavior
Created August 18, 2014 07:01
This behavior lets you order items in a very similar way to the tree behavior.
<?php
/**
* OrderedBehavior 2.2.2
*
*
* This behavior lets you order items in a very similar way to the tree
* behavior, only there is only 1 level. You can however have many
* independent lists in one table. Usually you use a foreign key to
* set / see what list you are in (see example bellow) or if you have
* just one list for the entire table, you can do that too.
@kozyty
kozyty / color.m
Created April 7, 2014 07:45 — forked from kylefox/color.m
/*
Distributed under The MIT License:
http://opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
@kozyty
kozyty / test.m
Created March 11, 2014 11:49
How do NSMutableAttributedString center and lineHeight?
/// paragraphStyle
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
[paragraphStyle setLineSpacing:10.0f];
paragraphStyle.maximumLineHeight = 15.0f;
/// mutableAttributedString
NSMutableAttributedString *attrStr = [NSMutableAttributedString attributedStringWithString:value];
/// 特定の条件
NSArray *hogeRanges = [value hogeRanges];
// ==UserScript==
// @name chatwork to all helper
// @match https://www.chatwork.com/*
// @version 1.2
// ==/UserScript==
(function() {
document.getElementById('_chatText').addEventListener('blur', function(e){
if (/[@@]{2}/.test(e.target.value)) {
var to_list = [];
cd /usr/local/src/
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar xf libevent-2.0.21-stable.tar.gz
./configure --prefix=/usr/local/libevent2
make
paco -D make install
cd /usr/local/src/
wget http://downloads.sourceforge.net/tmux/tmux-1.8.tar.gz
tar xf tmux-1.8.tar.gz
@kozyty
kozyty / sass_compress.rb
Last active December 15, 2015 15:48
sass compress
#!/usr/bin/env ruby
#-*- encoding: utf-8 -*-
#
# setup git-hook pre-commit command
# > bundle install --path [bundle_path]
# > curl -o .git/hooks/pre-commit https://raw.github.com/gist/5283926
# > chmod +x .git/hooks/pre-commit
require "sass/plugin"
puts "# pre-commit:gist-5283926 on git-hook."
@kozyty
kozyty / gist:3310982
Created August 10, 2012 04:07 — forked from yaegashi/gist:2361136
Git pre-commit hook script to verify file encodings.
#!/usr/bin/env perl
# Git pre-commit hook script to verify file encodings.
# Works with Perl 5.8. The bundled perl in msysgit is also supported.
# Copyright (C) 2012 Takeshi Yaegashi
# Encodings allowed to be committed.
my @allowed = qw/ascii utf8/;
# Encodings possible to be seen - optional.