Skip to content

Instantly share code, notes, and snippets.

View jlyu's full-sized avatar

Chain Yu jlyu

View GitHub Profile
@jlyu
jlyu / vimrc
Created September 5, 2012 06:03
My vim editor vimrc file. compatible with liunx and windows
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sections:
" -> General
" -> VIM user interface
" -> Colors and Fonts
" -> Files and backups
" -> Text, tab and indent related
" -> Visual mode related
" -> Moving around, tabs and buffers
" -> Status line
# !/bin/python
from __future__ import division
import sys
import random
"""
The script is rewritten JavaScript as Python.
====================================================
<script type="text/javascript">
<!--
# !/bin/python
"""
The script is rewritten C as Python.
====================================================
"""
for i in range(NPATH+1):
cash_flow[i]=payoff(stock[i][tmax], pexe)
@jlyu
jlyu / gist:3945874
Created October 24, 2012 12:49
Learning jQuery -2
$(document).ready(function(){
$('#selected-plays > li li').addClass('special');
$('tr').each(function(){
$(this).children('td:eq(2)').addClass('year');
});
$('tr:contains(Tragedy)').first().addClass('special');
$('a').parent().siblings().andSelf().addClass('afterlink');
@jlyu
jlyu / gist:3964480
Created October 27, 2012 12:27
Learning jQuery -5
$(document).ready(function(){
$('div.chapter a[href*="wikipedia"]').attr({
rel: 'external',
title: function() {
return 'Learn about ' + $(this).text() + ' at Wikipedia.';
},
id: function(index, oldValue) {
return 'wikilink-' + index;
}
});
@jlyu
jlyu / gist:3972050
Created October 29, 2012 07:05
Learning jQuery -7
//$.fn.cycle.defaults.random = true;
$(document).ready(function(){
$('#books').cycle({
timeout: 1000,
delay: -1000, // (1)
speed: 1500,
pause: true,
before: function(){
@jlyu
jlyu / gist:3999291
Created November 2, 2012 07:34
Learning jQuery -9
(function($) {
$.extend($.expr[':'], {
group: function(element, index, matches, set) {
var num = parseInt(matches[3], 10);
if (isNaN(num)){
return false;
}
return index % num < num;
},
@jlyu
jlyu / gist:6604879
Created September 18, 2013 05:22
小波滤波算法
const int datalen=32;
const int dbN=3;
const int stages=4;
/* interface array, put your signal data here and
pure signal is returned here after filtering*/
double dataio[datalen];
double data[datalen];// main data arrays
double har[stages][datalen];
double gar[stages][datalen];
#include <iostream>
using namespace std;
bool updateProcess(int pct)
{
cout << pct << "% complete...\n";
return (true);
}
@jlyu
jlyu / gist:7210857
Created October 29, 2013 08:25
blog theme
<!DOCTYPE html>
<html>
<head>
<link href="//aveline.oss.aliyuncs.com/themes/its-compiling/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
</head>
<body>
<div class="wrapper">