Skip to content

Instantly share code, notes, and snippets.

View satococoa's full-sized avatar

Satoshi Ebisawa satococoa

View GitHub Profile
Pod::Spec.new do |s|
s.name = 'NYXImagesKit'
s.version = '2.2'
s.platform = :ios
s.license = 'Simplified BSD license'
s.summary = 'A set of efficient categories for UIImage class. It allows filtering, resizing, masking, rotating, enhancing... and more.'
s.homepage = 'https://github.com/Nyx0uf/NYXImagesKit'
s.author = 'Benjamin Godard'
s.source = { :git => 'https://github.com/Nyx0uf/NYXImagesKit.git', :ref => '3daa60e66dabb5f513435675dbabe8c34ae6e6da' }
s.source_files = 'Categories', 'Classes', 'Helper'
@satococoa
satococoa / resize.rb
Created April 3, 2013 02:09
@2x.png をつけてリネーム -> 1/2サイズに縮小した画像を生成
require 'pathname'
resize_command = 'sips -z 34 34 --out out/%2$s %1$s'
copy_command = 'cp %s out/%s'
Pathname.glob('./in/*').sort.each_with_index do |path|
next unless path.to_s.match(/png$/)
basename = path.basename('.png').to_s
system(copy_command % [path.to_s, basename+'@2x.png'])
system(resize_command % [path.to_s, basename+'.png'])
export EDITOR=/usr/bin/vim
export CLICOLOR=1
export LSCOLORS=DxGxcxdxCxegedabagacad
export HISTSIZE=5000
export HISTFILESIZE=5000
export HISTCONTROL=ignoreboth
# alieases
alias r='rails'
alias g='git'
@satococoa
satococoa / loadable_image_view.rb
Last active December 12, 2015 02:38
ローディング中のぐるぐる機能つきの UIImageView ref: http://qiita.com/items/7ddbe9af6f323a322bf8
class LoadableImageView < UIImageView
attr_accessor :loading, :loading_view
def initWithFrame(rect)
super
@loading = false
@loading_view = UIActivityIndicatorView.alloc.initWithActivityIndicatorStyle(UIActivityIndicatorViewStyleWhite).tap do |lv|
lv.color = UIColor.blackColor
end
self
Motion::Project::App.setup do |app|
# (snip)
app.pods do
pod 'SocketRocket', :podspec => 'SocketRocket'
pod 'socket.IO', :podspec => 'socket.IO.podspec'
end
end
class TaskView < UIView
attr_accessor :task, :title, :done, :memo
def initWithFrame(rect)
super.tap do |v|
@title = subview(UILabel,
text: 'タスク',
font: UIFont.fontWithName('HiraKakuProN-W6', size:128),
backgroundColor: UIColor.clearColor,
textColor: UIColor.whiteColor,
@satococoa
satococoa / development.rb
Last active December 10, 2015 03:58
Rails.logger カスタマイズ
config.logger = ActiveSupport::TaggedLogging.new(Logger.new(config.paths['log'].first))
config.logger.formatter = lambda {|severity, datetime, progname, msg|
"%s, [%s #%d], %5s -- %s\n" % [severity[0..0], datetime.strftime('%Y-%m-%d %H:%M:%S')+('.%06d' % datetime.usec), $$, severity, msg]
}
config.logger.level = Logger::DEBUG
@satococoa
satococoa / migrate_one_to_two.rb
Created November 21, 2012 01:45
RubyMotion でシンプルな CoreData のマイグレーションを行うコード
module MigrateOneToTwo
module_function
def store_path
File.join(App.documents_path, 'store.sqlite')
end
def tmp_store_path
File.join(App.documents_path, 'store_tmp.sqlite')
end
@satococoa
satococoa / app_delegate.rb
Created October 30, 2012 05:19
crash when deployment_target='5.1' or '5.0'
class MyViewController < UIViewController
def viewDidLoad
super
view.backgroundColor = UIColor.whiteColor
end
def viewDidAppear(animated)
super
if TWTweetComposeViewController.canSendTweet
tw = TWTweetComposeViewController.new.tap do |c|
@satococoa
satococoa / monit.conf
Created October 23, 2012 03:19
Google Appsのメールサーバをmonitのアラート送信に使う
set mailserver smtp.gmail.com port 587
username "user@example.com" password "password"
using tlsv1
with timeout 30 seconds