Skip to content

Instantly share code, notes, and snippets.

View shirashin's full-sized avatar

shirashin shirashin

  • japan
View GitHub Profile
@shirashin
shirashin / create_file.vba
Created October 11, 2014 09:10
画像を列挙したエクセルシートを作るマクロみたいな
' ディレクトリ内のファイルを列挙
Sub CreateImgAlbum()
y = 3
' A1セルからディレクトリパス取得
root_dir = ActiveSheet.Cells(1, 1).Value
y = SearchDir(root_dir, y, root_dir)
Rows(5).EntireColumn.AutoFit
Cells(y, 1).ColumnWidth = 5
MsgBox "OK!!"
@shirashin
shirashin / gist:a969c340506249ff02a8
Created September 2, 2014 13:44
UnrealEngine4(view fps, hmd sp 100)
Begin Object Class=K2Node_Event Name="K2Node_Event_194"
Begin Object Class=EdGraphPin Name="EdGraphPin_2453"
End Object
Begin Object Class=EdGraphPin Name="EdGraphPin_2454"
End Object
Begin Object Name="EdGraphPin_2453"
PinName="OutputDelegate"
Direction=EGPD_Output
PinType=(PinCategory="delegate",PinSubCategoryObject=Function'/Script/Engine.Actor:ReceiveBeginPlay')
End Object
timelinesListApp.directive "whenScrolled", ($window) ->
(scope, element, attr) ->
angular.element($window).bind "scroll", ->
scrollTop = document.body.scrollTop || document.documentElement.scrollTop
clientHeight = $window.innerHeight
scrollHeight = document.body.scrollHeight || document.docomentElement.scrollHeight
clientHeight = window.innerHeight if scrollHeight == clientHeight
remain = scrollHeight - clientHeight - scrollTop
if remain <= 30
scope.$apply(attr.whenScrolled)
@shirashin
shirashin / spacer.css
Last active August 29, 2015 14:05
use sass version: sass3.2
.m-0 {
margin: 0px !important;
}
.mt-0 {
margin-top: 0px !important;
}
.mr-0 {
margin-right: 0px !important;
timelinesListApp.directive 'ckeditor', ->
require: '?ngModel'
link: (scope, elm, attr, ngModel)->
ck = CKEDITOR.instances[elm[0].id]
unless ngModel then return
ck.on 'pasteState', ->
scope.$apply ->
ngModel.$setViewValue ck.getData()
ngModel.$render = (value)-> ck.setData ngModel.$viewValue
@shirashin
shirashin / custom_failure.rb
Last active August 29, 2015 14:04
Deviseで認証失敗時にrootに遷移するようにする
# lib/custom_failure.rb[new]
class CustomFailure < Devise::FailureApp
def redirect_url
root_url # 遷移先
end
def respon
if http_auth?
http_auth
else
@shirashin
shirashin / devise.ja.yml
Created November 18, 2013 13:48
devise japanese locale
ja:
devise:
confirmations:
#confirmed: "Your account was successfully confirmed. You are now signed in."
confirmed: "アカウント登録完了。"
#send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
send_instructions: "数分後にアカウント確認方法をメールでお送りします。"
#send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
send_paranoid_instructions: "あなたのメールアドレスが登録済みの場合、数分であなたのアカウントを確認する方法を添えたメールが送信されるでしょう。"
failure:
@shirashin
shirashin / gist:4636726
Created January 25, 2013 18:30
JQueryUIのダイアログ拡張
class @Dialog
yesNoDialog:(target, dialog)->
jquery_dialog = $(dialog)
# ボタンの表示文字列を取得
buttons_ary = {}
buttons_ary[jquery_dialog.attr("dialog_ok")] = ->
$(@).dialog( "close" )
$(target).unbind("click")
target.click()
buttons_ary[jquery_dialog.attr("dialog_no")] = ->
@shirashin
shirashin / gist:4636177
Last active December 11, 2015 17:39
del_color.rb <dir> del_color.rb <file>
# Remove color tag("\color{xxxx}") from the TeX File.
dir_path = ARGV[0]
if dir_path.nil? || dir_path.size == 0
print "ERROR: select target!!\n"
exit 255
end
print "target: #{dir_path}\n"
if File.file?(dir_path)
paths = [File.expand_path(dir_path)]
@shirashin
shirashin / seeds.rb
Created January 24, 2013 17:21
RailsのシードファイルをCSVで運用してみるテスト
# CSV seedfile
# load csv seedfile on rails.
#
# db/
# ├── seeds
# │ └── User-0000.csv <-- seed csv
# └── seeds.rb <-- It's me
#
# [csv]
# name,email,password,role