Skip to content

Instantly share code, notes, and snippets.

View e2kaneko's full-sized avatar

tomo kaneko e2kaneko

View GitHub Profile
@e2kaneko
e2kaneko / jQuery's onload.js
Created November 13, 2010 14:26
jQueryのonloadイベント。window.onloadよりも前に実行される。
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" />
<script type="text/javascript">
$(document).ready(function(){
alert();
});
</script>
@e2kaneko
e2kaneko / prototype.js onload.js
Created December 29, 2010 06:54
prototype.js onload event
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js" />
Event.observe(window, "load", onload, false);
function onload(){
alert("onload");
}
@e2kaneko
e2kaneko / gist:891591
Created March 29, 2011 00:10
Java - 拡張For文でMapをループ
for(Map.Entry<String, String> entry : map.entrySet()) {
System.out.println(entry.getKey());
System.out.println(entry.getValue());
}
@e2kaneko
e2kaneko / gist:907006
Created April 7, 2011 03:51
HTML5 placeholder
<input name="text" type="text" placeholder="ex.e2kaneko">
@e2kaneko
e2kaneko / gist:907007
Created April 7, 2011 03:54
jQueryイベントアタッチ
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" />
<script type="text/javascript">
$(document).ready(function(){
$(".name").change(function(){
$("#formSubmitType").val("changeName");
$("#profileForm").submit();
});
$("#button").click(function(){
$("#formSubmitType").val("buttonClick");
@e2kaneko
e2kaneko / gist:947893
Created April 29, 2011 05:30
jQueryで、アニメーションしてから要素を削除するコード
target.hide("slow", function(){
target.remove();
});
@e2kaneko
e2kaneko / gist:955209
Created May 4, 2011 13:30
PHP - TwitterOAuthLogin~Callback
<?php
// ----- Authorization ----- //
$consumerKey = TWITTER_CONSUMER_KEY;
$consumerSecret = TWITTER_CONSUMER_SECRET;
$callbackUrl = "http://example.com/action/TwitterAuthCallback";
$oAuth = new HTTP_OAuth_Consumer($consumerKey, $consumerSecret);
$httpRequest = new HTTP_Request2();
$httpRequest->setConfig("ssl_verify_peer", false);
@e2kaneko
e2kaneko / gist:955217
Created May 4, 2011 13:37
PHP PEARのHTTP/OAuth/ConsumerをTwitter用に改造(username, useridの取得)
<?php
class HTTP_OAuth_Consumer extends HTTP_OAuth
{
protected $userId = null;
protected $screenName = null;
// 略
public function getAccessToken($url, $verifier = '',
array $additional = array(), $method = 'POST'
@e2kaneko
e2kaneko / gist:969955
Created May 13, 2011 04:03
jQuery - スクロール位置を移動
$("html,body").animate(
{scrollTop: $("#element_id").offset().top},
0
);
@e2kaneko
e2kaneko / gist:975671
Created May 17, 2011 00:51
.htaccess データファイルアクセス制限
<Files ~ "\.(dat|log|csv)$">
deny from all
</Files>