2012年6月28日木曜日

MarsEdit

こんにちは、宮本です。

お試しで, MarsEditのアプリ使ってます。

よろしくお願いします。感想は後ほど。

2012年6月13日水曜日

ブログバーツのjavascriptのembedができない

あまりにもblogの整形をしていないので、まずcodeにsyntaxhighlightをしようってことで
gistに集める作戦にしました。

あとで、とりあえずハマッたり、ぐぐって書いたコードはgistに登録しておいて
blog書くときはgistのembed機能を使う。
provate repoばかりのgithubをpublicな感じにできるのかなーってことで。

しかし、scriptを埋め込んでも表示されない現象なりました。
何度貼り直しても表示されないし、ずっとなんでだと放置して諦めていたけど、ふとmobileでみたら表示されてる!?

ってことでtemplateを疑って変えてみたら表示された!!

その時bloggerの動的templateを使っていたのだけど、
なにかjs的なとこで干渉してるみたいで表示されてないみたいでしたー。

他にも埋込みjs scriptとかだと不具合起こる可能性ありますから、一回疑ってみても良いかもですね

2012年5月30日水曜日

wordpress customfieldに文章を書けるようにする方法。(改行使えたり、リンクタグが飛び出ない)

アンカータグを使うと width 指定した div.wrapからはみ出たりする。 そこで、cssで以下のように white-spaceをしてする。
アンカータグ<a></a>を使うと width 指定した div.wrapからはみ出たりする。


そこで、cssで以下のように white-spaceをしてする。



すると、通常や改行や半角スペースがひとつにまとめられてしまうところ


改行や半角文字として認識してくれる!


http://www.htmq.com/style/white-space.shtml


ただし、


<p>


ちわー


</p>


とか無駄なインデントや改行もそのまま反映されるので、その辺は注意ですね。

2012年5月29日火曜日

instagram-ruby-gem の undefined method `configure' for Instagram:Module(NoMethodError) 続き

$ bundle isntall


できたーと思って


$rails s


起動したら今度は


Bundler could not find compatible versions for gem "faraday":


In snapshot (Gemfile.lock):


faraday (0.8.0)


In Gemfile:


instagram (>= 0) ruby depends on


faraday (= 0.7.6) ruby


Running `bundle update` will rebuild your snapshot from scratch, using only


the gems in your Gemfile, which may resolve the conflict.


今度はfaradayで喧嘩。

ググる。

https://github.com/Instagram/instagram-ruby-gem/issues/33


というわけで、0.7.6にあわせればいいらしい。


forkして、


local に clone


instagram.gemspec


s.add_runtime_dependency('faraday', '0.7.6')

に変更。

$ git add . $ git commit -a -m 'changed faraday verstion to 0.7.6 $ git push origin master

これで

Gemfile

'gem 'instagram', :git => 'git://github.com/yahsan2/instagram-ruby-gem.git'

に変更。

再びGem.lockを消して$ bundke install$rails s

できたー!!!!






2012年5月28日月曜日

instagram-ruby-gem の undefined method `configure' for Instagram:Module (NoMethodError)

instagram-ruby-gem を bundle install後、rails sで起動したら、以下のエラーが起きたのでメモ。


/config/initializers/instagram.rb:5:in `<top (required)>': undefined method `configure' for Instagram:Module (NoMethodError)


Gemfile


gem 'instagram'


と記述して


$bundle install


$rails s


で起動。


/config/initializers/instagram.rb:5:in `<top (required)>': undefined method `configure' for Instagram:Module (NoMethodError)


のエラー


ググる。


https://github.com/Instagram/instagram-ruby-gem/issues/21


こちらがヒット。


Gemfile


gem 'instagram', :git => 'git://github.com/Instagram/instagram-ruby-gem.git'


と記述して


$ bundle install

Updating git://github.com/Instagram/instagram-ruby-gem.gitFetching gem metadata from https://rubygems.org/.......Fetching gem metadata from https://rubygems.org/..Bundler could not find compatible versions for gem "multi_json": In snapshot (Gemfile.lock): multi_json (1.3.4)

In Gemfile: instagram (>= 0) ruby depends on multi_json (~> 1.0.3) ruby

Running `bundle update` will rebuild your snapshot from scratch, using onlythe gems in your Gemfile, which may resolve the conflict.

今度はgemどうしで喧嘩。

https://github.com/kylefox/instagram-ruby-gem/commit/95dbe0af2bfe1061aa757bf88726370ccb475ce4

これ読み込んだりこれように、forkなどして変更したがダメ。

とりあえず、gemなおしてgem 'instagram', :git => 'git://github.com/Instagram/instagram-ruby-gem.git'

なんとなく In snapshot (Gemfile.lock):ってあるから、これ全部消して

$bundle install

...

...Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

!! できた!?

$rails s

動いた!!よくわからけど、これで喧嘩収まることもあるらしいです。



ちなみで、https://github.com/mshk/Instagram-on-Rails-Sample

を参考にして、appは作ってったー






2012年2月16日木曜日

custom post type x posts2postsのプラグインの組み合わせが便利すぎにゃん

マジ便利やで。


posts 2 posts が まぁ幅広ーくなったかんじ。



// function my_connection_types() {
// Make sure the Posts 2 Posts plugin is active.


if ( !function_exists( 'p2p_register_connection_type' ) )


return;


// Keep a reference to the connection type; we'll need it later


global $people_connection_type;


global $place_connection_type;


global $event_connection_type;


$place_connection_type = p2p_register_connection_type( array(


'from' => 'events',


'to' => 'places'


) );


$people_connection_type = p2p_register_connection_type( array(


'from' => 'events',


'to' => 'people'


) );


$event_connection_type = p2p_register_connection_type( array(


'from' => 'people',


'to' => 'places'


) );


}


add_action( 'init', 'my_connection_types', 100 );




Add Quick tag プラグイン custom posts の適応 wodpress

まぁここ見たら書いてあるんですけどね(´・ω・`)


http://wordpress.org/extend/plugins/addquicktag/




function.php


// add custom function to filter hook ‘addquicktag_post_types’



add_filter( 'addquicktag_post_types', 'my_addquicktag_post_types' );
/**
* Return array $post_types with custom post types
*
* @param $post_type Array
* @return $post_type Array
*/
function my_addquicktag_post_types( $post_types ) {

$post_types[] = 'my_custom_post_type1';
$post_types[] += 'my_custom_post_type2';
$post_types[] += 'my_custom_post_type3';

return $post_types;
}


てな感じで,配列にcustompost名をぶち込んでけばよいのだよ.