Skip to content

Instantly share code, notes, and snippets.

View jlyu's full-sized avatar

Chain Yu jlyu

View GitHub Profile

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@jlyu
jlyu / Singleton.js
Last active September 25, 2017 07:24
var Singleton = (function(){
var _instance;
function init() {
function privateMethod() {}
var privateVariable = "42";
var privateRandomX = Math.random();
return {
publicMethod: function() {},
publicProperty: "23",
getRandomX: function() { return privateRandomX; }
@jlyu
jlyu / 0_reuse_code.js
Created June 9, 2017 02:35
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@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">
#include <iostream>
using namespace std;
bool updateProcess(int pct)
{
cout << pct << "% complete...\n";
return (true);
}
@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];
@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: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: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: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');