Skip to content

Instantly share code, notes, and snippets.

View ryonakae's full-sized avatar
🙄

Ryo Nakae ryonakae

🙄
View GitHub Profile
@ryonakae
ryonakae / middleman_yaml_nested.slim
Created March 25, 2014 01:21
Middleman + SlimでネストされたYAMLのデータを取得する
ul
- data.test.items.each do |item|
li
= item.name
ul
- item.subitems.each do |subitem|
li = subitem.subname
@ryonakae
ryonakae / ruby_uninstall_all_gems.txt
Created April 11, 2014 03:21
Rubyで全てのgemを一括削除
sudo gem uninstall -axI `gem list --no-versions | grep -v (sqlite|libxml) `
@ryonakae
ryonakae / simple-local-server.py
Created July 14, 2014 09:26
Simple Local Server
# http://0.0.0.0:8000
python -m SimpleHTTPServer
@ryonakae
ryonakae / git_diff_zip.sh
Last active August 29, 2015 14:06
gitで差分ファイルを抽出してzipにまとめる
# 直前のコミットとの差分
git archive --format=zip --prefix=archive/ HEAD `git diff --name-only HEAD HEAD~1` -o archive.zip
# 特定のコミットとの差分
git archive --format=zip --prefix=archive/ HEAD `git diff --name-only HEAD コミットのハッシュ値` -o archive.zip
# http://h2ham.net/git-diff-file-zip
# 参考:
# https://gist.github.com/mollifier/4979906
# http://webtech-walker.com/archive/2008/12/15101251.html
########################################
# 環境変数
export LANG=ja_JP.UTF-8
# 色を使用出来るようにする
@ryonakae
ryonakae / retinaBgImg.sass
Last active August 29, 2015 14:07
Compassで使用可能な、background-sizeを使った@2x以上の画像を背景にする場合に便利なmixin
// Retina Background Image
// 第1引数に画像のファイル名
// 第2引数に画像の倍率(@2xなら2、@3xなら3)
=retinaBgImg($image:"image.png", $ratio:2)
$imageWidth: image-width($image) / $ratio
$imageHeight: image-height($image) / $ratio
background-image: image-url($image)
background-size: $imageWidth $imageHeight
background-repeat: no-repeat
@ryonakae
ryonakae / mkvtomp4.sh
Last active August 29, 2015 14:13
MKVファイルをMP4ファイルに変換(動画はコピー、音声はAACに変換)
#!/bin/sh
DIRPATH=$1
for FILE in ${DIRPATH}*.mkv
do
# AAC
# ffmpeg -y -i "${FILE}" -vcodec copy -acodec aac -strict experimental -ab 320k "${FILE%.mkv}.mp4"
# Stream Mapping
ffmpeg -y -i "${FILE}" -vcodec copy -acodec aac -strict experimental -ab 320k -map 0:0 -metadata:s:v:0 language=jpn -map 0:1 -metadata:s:a:1 language=jpn "${FILE%.mkv}.mp4"
done
@ryonakae
ryonakae / example.js
Last active September 25, 2018 06:58
Gulpで、JSファイル内で別のJSファイルをインクルードしつつ、ライセンスコメントは残してUglify
//= include ../libs/jquery.min.js
//= include ./_common.js
console.log('Hello world');
@ryonakae
ryonakae / tumblr_replace_image_url.js
Last active February 3, 2016 11:06
Tumblrの投稿にある画像を無理やり横1280pxにするJavaScript
document.addEventListener('DOMContentLoaded', function(){
// imgタグ一覧を取得
var _images = document.getElementsByTagName('img');
// _imagesがオブジェクト(ノードリスト)なので配列に変換する
var _imagesArray = Array.prototype.slice.call(_images);
// _imagesArrayをforEachで回す
// 正規表現にマッチしたら、画像URLの拡張子直前の数字を全部1280に書き換え
_imagesArray.forEach(function(element, index, array){
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->