This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://stackoverflow.com/questions/37310640/rxjs-buffer-how-to-group-multi-click-events-as-stream/51547034#51547034 | |
const btn = document.querySelector('#btn'); | |
const click$ = Rx.Observable.fromEvent(btn, "click"); | |
const trigger$ = | |
click$.exhaustMap(r => | |
click$ | |
.take(2) | |
.last() | |
.race(click$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// inputTask :: String -> String -> Task | |
const name = 'dong'; | |
most.periodic(1000).take(25) | |
.scan( (x,y) => x + 1, 0) | |
.map( x => name[x%4]) | |
.observe(console.log); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> | |
<file source-language="en" datatype="plaintext" original="ng2.template"> | |
<body> | |
<trans-unit id="introductionHeader" datatype="html"> | |
<source> | |
Hello i18n! | |
</source> | |
<target> | |
Bonjour i18n ! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
// AMD | |
define(['jquery'], factory); | |
} else if (typeof exports === 'object') { | |
// Node, CommonJS-like | |
module.exports = factory(require('jquery')); | |
} else { | |
// Browser globals (root is window) | |
root.returnExports = factory(root.jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.defineProperty(Number.prototype,'fileSize',{value:function(a,b,c,d){ | |
if(this == 0){ | |
return "0.0 B"; | |
}else if(this < 0.001){ | |
return this.toExponential(1) + " B"; | |
}else if(this < 1){ | |
return this.toLocaleString() + " B"; | |
} | |
return (a=a?[1e3,'k','B']:[1024,'K','iB'],b=Math,c=b.log, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009" | |
xmlns:s="library://ns.adobe.com/flex/spark" | |
xmlns:mx="library://ns.adobe.com/flex/mx" initialize="loadPage()" borderStyle="solid" styleName="container"> | |
<fx:Script> | |
<![CDATA[ | |
import mx.containers.HBox; | |
import mx.controls.Alert; | |
import mx.controls.Image; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fx:Script> | |
<![CDATA[ | |
private function labelPhaseEffortVertical(labelValue:Object, previousLabelValue:Object, axis:AxisBase):String | |
{ | |
return labelValue + "Hrs"; | |
} | |
]]> | |
</fx:Script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mx:PieChart x="92" y="200" id="pieTeamEffort" dataProvider="{teamEffort}" showDataTips="true"> | |
<mx:series> | |
<mx:PieSeries displayName="Effort" field="effort" nameField="name"> | |
<mx:showDataEffect> | |
<mx:SeriesInterpolate duration="1000"/> | |
</mx:showDataEffect> | |
</mx:PieSeries> | |
</mx:series> | |
</mx:PieChart> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# h = [["a", 100], ["c", 300], ["d", 400]] 怎么转化成 {"c" => 300, "a" => 100, "d" => 400, "c" => 300 }这样一个hash | |
h.flatten! | |
Hash[*h] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'rexml/document' | |
# Web search for "madonna" | |
url = 'http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=YahooDemo&query=madonna&results=2' | |
# get the XML data as a string | |
xml_data = Net::HTTP.get_response(URI.parse(url)).body | |
# extract event information |