Skip to content

Instantly share code, notes, and snippets.

Avatar

sei0o inoue sei0o

View GitHub Profile
@sei0o
sei0o / rails_form_issue.css
Created Feb 9, 2014
Railsのform_forやbutton_toでauthenticity_tokenとかを含んだdivが邪魔
View rails_form_issue.css
form > div:first-child {
display: none !important;
}
@sei0o
sei0o / bui-select.scss
Last active Aug 29, 2015
BlackUI - select element style ( CSS3: appearance, transition, text-overflow ... )
View bui-select.scss
.bui_select{
display:inline;
position:relative;
&:after {
content: "";
position: absolute;
top: 50%;
right: 20px;
display: block;
width: 0;
@sei0o
sei0o / get_class_variables.rb
Created Mar 6, 2014
外部のmoduleから別のmoduleのクラス変数にアクセス(定数じゃなくて) | module間で変数を共有
View get_class_variables.rb
module A
@@hoge = 300
end
module B # Aのクラス変数をGet
piyo = A.module_eval { class_variable_get :@@hoge }
p piyo # => 300
end
@sei0o
sei0o / ud.m
Last active Aug 29, 2015
NSUserDefaultsから取ってきたアレをalert
View ud.m
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
int value = [ud integerForKey:@"hogelo"]; // 値をとってくる
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"タイトルだお"
message: [value description] // int型をNSStringに変換するお 
delegate: nil
cancelButtonTitle: nil
otherButtonTitles: @"OK", nil // nilを忘れない
];
@sei0o
sei0o / file_delete.rb
Created Feb 8, 2015
ファイルを削除
View file_delete.rb
File.delete "filename.txt"
@sei0o
sei0o / erb_text.rb
Created Feb 8, 2015
ERBを単体で使う
View erb_text.rb
require 'erb'
str = "hello <%= sushi %>"
sushi = "japan"
erb = ERB.new str
erb.result binding
@sei0o
sei0o / file_create_write.rb
Created Feb 8, 2015
ファイル生成&書き込み
View file_create_write.rb
str = "hogehoge"
File.open "puyo.txt", "w" do |f|
f.write str
end
@sei0o
sei0o / p.md
Created Jul 30, 2015
プログラミングで苦労するところ
View p.md

プログラミングで苦労するところ

  • Ruby: lake(湖)をrakeと書き間違える
  • OOP: インスタンラーメン
@sei0o
sei0o / puma.rb
Last active Dec 22, 2015
supervisorとpumaとnginx(SSL)のconfig
View puma.rb
root = Dir.getwd.to_s
bind "unix://#{root}/tmp/puma/socket"
pidfile "#{root}/tmp/puma/pid"
state_path "#{root}/tmp/puma/state"
rackup "#{root}/config.ru"
threads 4, 8
activate_control_app
View iPhone5SC.countdown.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="iPhone5SC.countdown.css">
<link href='http://fonts.googleapis.com/css?family=Noto+Sans' rel='stylesheet' type='text/css'>
<!--<script src="iPhone5SC.countdown.js"></script>-->
</head>
<body>
<div class="icount">
<a href="http://apple.com/jp/iphone/">
You can’t perform that action at this time.