Skip to content

Instantly share code, notes, and snippets.

View yasu00000's full-sized avatar

yasuhiro nishioka yasu00000

View GitHub Profile
@yasu00000
yasu00000 / gist:6665592
Created September 23, 2013 01:41
jQuery Ajax error hadling function
$(function() {
$.ajaxSetup({
error: function(jqXHR, exception) {
if (jqXHR.status === 0) {
alert('Not connect.\n Verify Network.');
} else if (jqXHR.status == 404) {
alert('Requested page not found. [404]');
} else if (jqXHR.status == 500) {
alert('Internal Server Error [500].');
} else if (exception === 'parsererror') {
@yasu00000
yasu00000 / james-b-glattfelder-who-controls-the-world.md
Created February 18, 2013 02:51
Gisted: James B. Glattfelder: Who controls the world? | Video on TED.com
@yasu00000
yasu00000 / gist:3392847
Created August 19, 2012 06:40
sqlite2でのAlter table
BEGIN TRANSACTION;
CREATE TEMPORARY TABLE test_temp(a integer,b integer,c integer);
INSERT INTO test_temp SELECT * FROM test;
DROP TABLE test;
CREATE TABLE test (a integer,b integer,c integer,d integer);
INSERT INTO test SELECT *,null FROM test_temp;
DROP TABLE test_temp;
COMMIT;
@yasu00000
yasu00000 / gist:3392760
Created August 19, 2012 06:37
MacPorts不要ファイル削除
port -u uninstall
port clean --all installed
//input type, id, name, all inputs
$('input #inputid').attr("disabled", "disabled");
@yasu00000
yasu00000 / gist:821782
Created February 11, 2011 01:52
Popup Windows Opener
jQuery('a.popup').live('click', function(){
newwindow=window.open($(this).attr('href'),'','height=200,width=150');
if (window.focus) {newwindow.focus()}
return false;
});
@yasu00000
yasu00000 / gist:821781
Created February 11, 2011 01:52
Mouse Position
function rPosition(elementID, mouseX, mouseY) {
var offset = $('#'+elementID).offset();
var x = mouseX - offset.left;
var y = mouseY - offset.top;
return {'x': x, 'y': y};
}
@yasu00000
yasu00000 / gist:821779
Created February 11, 2011 01:51
Partial Page Refresh
setInterval(function() {
$("#refresh").load(location.href+" #refresh>*","");
}, 10000); // seconds to wait, miliseconds
@yasu00000
yasu00000 / gist:821777
Created February 11, 2011 01:50
Text Search
$.fn.egrep = function(pat) {
var out = [];
var textNodes = function(n) {
if (n.nodeType == Node.TEXT_NODE) {
var t = typeof pat == 'string' ?
n.nodeValue.indexOf(pat) != -1 :
pat.test(n.nodeValue);
if (t) {
out.push(n.parentNode);
}
@yasu00000
yasu00000 / gist:816312
Created February 8, 2011 11:48
下部にフッター固定
#footer {
position:fixed;
left:0px;
bottom:0px;
height:30px;
width:100%;
background:#999;
}
/* IE 6 */
* html #footer {