Skip to content

Instantly share code, notes, and snippets.

View naiteluo's full-sized avatar
:electron:

mob naiteluo

:electron:
  • School of Software, Sun Yat-sen University
  • Guangzhou, China
View GitHub Profile
@naiteluo
naiteluo / 📊 Weekly development breakdown
Last active January 27, 2023 16:03
📊 Weekly development breakdown
JSON 0 secs ████████▍░░░░░░░░░░░░ 40.5%
TypeScript 0 secs ███████▌░░░░░░░░░░░░░ 35.9%
Markdown 0 secs ████▏░░░░░░░░░░░░░░░░ 19.9%
C++ 0 secs ▎░░░░░░░░░░░░░░░░░░░░ 1.3%
JavaScript 0 secs ▏░░░░░░░░░░░░░░░░░░░░ 1.1%
@naiteluo
naiteluo / glu_replacement.cpp
Created July 30, 2021 02:39
gluLookAt replacement
GLAPI void GLAPIENTRY
gluLookAt(GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ,
GLdouble upX, GLdouble upY, GLdouble upZ) {
int i;
Me::Vector3f forward, side, up;
Me::Matrix4X4f m;
forward.x = centerX - eyeX;
forward.y = centerY - eyeY;
@naiteluo
naiteluo / readfiles.js
Created September 30, 2016 06:41
generator examples
run(function*(){
try{
var tpContent = yield readFile('blog_post_template.html');
var mdContent = yield readFile('my_blog_post.md');
resp.end(template(tpContent, markdown(String(mdContent))));
}catch(e){
resp.end(e.message);
}
});
@naiteluo
naiteluo / isArray.js
Created October 5, 2014 03:24
JavaScript Patterns
if (typeof Array.isArray === 'undefinded') {
Array.isArray = function (arg) {
return Object.prototype.toString.call(arg) === '[Object Array]';
};
}
@naiteluo
naiteluo / GIFPlater_usage.as
Created June 18, 2014 08:05
ActionScript 3 Snippets
var _gifPreview:GIFPlayer = new GIFPlayer();
var _fr:FileReference = fr;
var _ba:ByteArray = _fr.data;
_gifPreview.loadBytes(_ba);
// _gifPreview is a Shape, just append to some where
@naiteluo
naiteluo / no-trigger.js
Created September 6, 2012 10:00
jQuery, trigger
// 沒有使用trigger
/**
* 按鈕A,點擊後彈出登陸框
*/
(function () {
$('.btn-a').bind('click', function () {
// 彈出登陸框
$('.login-form').show();
// balabalabala
@naiteluo
naiteluo / comments.html
Last active October 10, 2015 07:08
css hack
<!-- 条件注释hack法 -->
<!--[if IE 6]>
<link type="text/css" rel="stylesheet" href="ie6.css" />
<![endif]-->
<!--[if gt IE 7]>
<link type="text/css" rel="stylesheet" href="ie6.css" />
<![endif]-->
<!--[if gt IE 8]>
<link type="text/css" rel="stylesheet" href="ie6.css" />
@naiteluo
naiteluo / StringConcatenation.js
Created August 31, 2012 14:13
some interesting things about JavaScript
// 较慢
str += 'one' + 'two';
str = 'one' + str + 'two';
// 在IE7+,以及其他浏览器中以下两种都较快
str += 'one';
@naiteluo
naiteluo / DOM动画操作.js
Created August 31, 2012 06:45
JavaScript snippets
/**
* DOM动画方法扩展
* 使用方法:
* document.getElementsByTagName('div')[0].hide(200);
* document.getElementsByTagName('div')[0].show(500);
* document.getElementsByTagName('div')[0].animate(300, 300, 500);
*/
(function (d) {
@naiteluo
naiteluo / hasLayout.css
Created August 29, 2012 13:47
css snippets
/**
* 触发hasLayout
* IE下css解析的一些诡异问题可能与hasLayout没被触发
*/
.test-old {
height: 1%;
}
.test-best {