Skip to content

Instantly share code, notes, and snippets.

View 6174's full-sized avatar

Marc Chen 6174

View GitHub Profile
@6174
6174 / execCommand.html
Created August 12, 2013 05:50
execCommand兼容性测试脚本
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script>
window.onload=function (){
function getCommandList(){
return {'2D-Position':true,
'absolutePosition':true,
@6174
6174 / rust_linear_regression
Last active November 13, 2019 08:54
rust linear regression
// ==================================
// linear regression trainer in rust
// @author 6174
// ==================================
// use std::cell::RefCell;
use std::vec::Vec;
fn main() {
// linear_regression();
@6174
6174 / html-decode.js
Created August 14, 2013 08:42
html decode and encode function
function html_encode(str)
{
var s = "";
if (str.length == 0) return "";
s = str.replace(/&/g, "&gt;");
s = s.replace(/</g, "&lt;");
s = s.replace(/>/g, "&gt;");
s = s.replace(/ /g, "&nbsp;");
s = s.replace(/\'/g, "&#39;");
s = s.replace(/\"/g, "&quot;");
@6174
6174 / whichTransitionEvent.js
Created August 8, 2013 08:40
transitionEnd s事件兼容
function whichTransitionEvent(){
var t;
var el = document.createElement('fakeelement');
var transitions = {
'transition':'transitionend',
'OTransition':'oTransitionEnd',
'MozTransition':'transitionend',
'WebkitTransition':'webkitTransitionEnd'
}
@6174
6174 / connection.js
Last active October 19, 2018 08:44
learn Snapsvg
Snap.plugin(function(Snap, Element, Paper, global, Fragment) {
// Snap.newmethod = function () {};
// Paper.prototype.newmethod = function () {};
/**
* connection
*/
Paper.prototype.connection = function(obj1, obj2, line, bg) {
if (obj1.line && obj1.from && obj1.to) {
line = obj1;
obj1 = line.from;
@6174
6174 / Guess.js
Created November 17, 2017 02:54
平均优化
/**
* <p>Desc:竞彩类</p>
* <p>Author: luochang</p>
* <p>Copyright: Copyright (c) 2012</p>
* <p>Company: 北京中科易达科技发展有限责任公司</p>
* Added by Luochang at 2014/3/6 Version 1.0
*/
function Guess(lienseId, playId) {
this.licenseId = lienseId; // 彩种,9-竞彩足球,10-竞彩篮球
/*
* Ticker by Grant Skinner. Dec 5, 2010
* Visit http://easeljs.com/ for documentation, updates and examples.
*
*
* Copyright (c) 2010 Grant Skinner
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
@6174
6174 / introrx.md
Last active February 6, 2018 09:59 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@6174
6174 / go.js
Created August 14, 2017 02:23
gojs parsed source
This file has been truncated, but you can view the full file.
(function(window) {
var g, da = {};
if (!window.document || void 0 === window.document.createElement("canvas").getContext) {
throw window.console && window.console.log("The HTML Canvas element is not supported in this browser,or this browser is in Compatibility mode."), Error("The HTML Canvas element is not supported in this browser,or this browser is in Compatibility mode.")
}
if (!Object.defineProperty) {
throw Error("GoJS requires a newer version of JavaScript")
}
Function.prototype.bind || (Function.prototype.bind = function(a) {
function b() {
@6174
6174 / main.css
Created June 12, 2017 01:31
litttle iso city generator colored https://codepen.io/nicoptere/pen/awzbQW
html,
body {
width: 100%;
height: 100%;
overflow: hidden;
top: 0;
left: 0;
margin: 0;
padding: 0;
}