よく忘れてしまうので、mysqlのuser系のコマンドのまとめ
-
ユーザー作成
-
create user 'username'@'host'
-
ユーザー変更
-
rename user old to new
-
ユーザー一覧
-
select Host,User from mysql.user;
よく忘れてしまうので、mysqlのuser系のコマンドのまとめ
ユーザー作成
create user 'username'@'host'
ユーザー変更
rename user old to new
ユーザー一覧
select Host,User from mysql.user;
# railsのmodelで***_path(resourceのURL)を使う方法 | |
- Rails.application.routes.url_helpers.posts_path | |
- 参考 | |
- http://stackoverflow.com/questions/5380703/rails-get-resource-path-in-model | |
- ところが、これだと、パスしか分からない。URLのホスト部分が入らない。 | |
- posts_urlに変えると、以下のエラーが出る。 | |
- ArgumentError (Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true): |
# omniauth + omniauth-twitter gems are required | |
class TwitterApi | |
SITE = "http://api.twitter.com" | |
API_URL = { :update_status => SITE + "/1.1/statuses/update.json"} | |
def self.feed | |
access_token = official_access_token | |
response = access_token.request(:post, | |
API_URL[:update_status], |
jasmine rails
https://github.com/searls/jasmine-rails
railsでjasmine使うためのgem。
coffeeでも書ける。
// sample | |
var MyView = Marionette.ItemView.extend({ | |
template: "my-template-id" | |
}); | |
var myView = new MyView({ model: Dog}); | |
myView.render(); | |
// ItemView sample |
<html> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/ractive.js/0.3.7/ractive.min.js"></script> | |
<body> | |
<div id="result"> | |
</div> | |
<p>※consoleから、ractive.set('messages.unread', 5); とコピペして実行してみると</p> | |
</body> | |
<script id='myTemplate' type="text/ractive"> | |
<p>こんにちわ{{user}} さん。 | |
<strong>{{messages.unread}} 件の未読メッセージがあります。</strong> |