Skip to content

Instantly share code, notes, and snippets.

View usagizmo's full-sized avatar

usagizmo

View GitHub Profile
@usagizmo
usagizmo / trim.jsx
Last active August 29, 2015 14:05
[Photoshop Script] 指定フォルダ内の PNG 画像をトリミングしてWeb用に保存
function saveForWebPNG(doc, folder, filename) {
var sfwOptions = new ExportOptionsSaveForWeb();
sfwOptions.format = SaveDocumentType.PNG;
sfwOptions.PNG8 = false;
doc.exportDocument(new File(folder + '/' + filename), ExportType.SAVEFORWEB, sfwOptions);
}
function main() {
var inputFolder = Folder.selectDialog('トリミングしたい画像の入ったフォルダを選択してください');
@usagizmo
usagizmo / exif.rb
Created October 18, 2014 22:31
写真/動画の作成日/更新日情報をExifの情報に置換する
# coding: utf-8
require 'mini_exiftool'
require 'find'
Find.find('files') do |f|
next unless File.file? f
begin
exif = MiniExiftool.new f
rescue
@usagizmo
usagizmo / mv_10kb.rb
Created October 18, 2014 22:34
10KB以下のファイルを trashed ディレクトリに移動する
# coding: utf-8
require 'find'
require 'fileutils'
Find.find('files') do |f|
next unless File.file? f
size = File.size?(f)
if size.nil? || size < 10000 # 10KB
puts f
@usagizmo
usagizmo / move_all_photos.js
Last active August 29, 2015 14:17
iPhotoのすべてのオリジナル画像を特定のディレクトリに移動
var fs = require('fs');
var glob = require('glob');
var path = require('path');
var Exif = require('exif').ExifImage;
var imageDir = 'photos/';
glob('Masters/**/*', function(err, files) {
if (err) throw err;
files.forEach(function(file) {
@usagizmo
usagizmo / set_from_filename.rb
Last active July 7, 2016 07:31
写真ファイルの作成日/更新日のメタ情報をファイル名から置換する
# coding: utf-8
require 'find'
require 'time'
Find.find 'files' do |f|
if File.basename(f).match /\d{4}-\d{2}-\d{2} \d{2}\.\d{2}\.\d{2}/
originaltime = Time.parse File.basename(f, File.extname(f)).gsub '.', ':'
File.utime File.atime(f), originaltime, f unless originaltime.nil?
end
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
sudo find . -name ".DS_Store" -depth -exec rm {} \;
sublime.log_commands(True)
<?php
// 言語、文字コードを設定する
mb_language('uni');
mb_internal_encoding('UTF-8');
function map_htmlspecialchars($request)
{
return array_map(function ($value) {
return is_array($value) ?
map_htmlspecialchars($value) :