Skip to content

Instantly share code, notes, and snippets.

View nathanchen's full-sized avatar

Nathan nathanchen

View GitHub Profile
@nathanchen
nathanchen / jQuery - Change Text color and background color.js
Created August 3, 2012 02:12
jQuery - Change Text color and background color
$(':button').click(function () {
$('p').css('background-color', '#000').css('color', '#fff');
});
@nathanchen
nathanchen / jQuery - fadein.js
Created August 3, 2012 01:57
jQuery - fadein
$(document).ready(function () {
$('#message').fadeIn('slow');
});
@nathanchen
nathanchen / JAVA: 比较两个字节数组.java
Created August 2, 2012 14:12
JAVA - 比较两个字节数组
public int compareTo(byte[] buffer1, int offset1, int length1, byte[] buffer2, int offset2, int length2)
{
if(buffer1 == buffer2 && offset1 == offset2 && length1 == length2)
return 0;
int end1 = offset1 + length1;
int end2 = offset2 + length2;
for(int i = offset1, j = offset2; i < end1 && j < end2;
@nathanchen
nathanchen / jQuery: getNumOfTags.js
Created August 1, 2012 02:15
jQuery - get number of tags
var count = $('*').length;
alert(count);
@nathanchen
nathanchen / jQuery: buttonDoubleClickDisable.js
Created August 1, 2012 02:13
jQuery - Once button was clicked, change its value to 'Please wait...' and disable it
$(':submit').click(function () {
$(this).attr('value', 'Please wait...');
$(this).attr('disabled', 'true');
});
@nathanchen
nathanchen / jQuery: Mouse FocusIn and Blur to change background color.js
Created August 1, 2012 02:11
jQuery - Mouse FocusIn and Blur to change background color
$(':text').focusin(function () {
$(this).css('background-color', 'yellow');
});
$(':text').blur(function () {
$(this).css('background-color', '#fff');
});