This file contains hidden or 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
| #!/usr/bin/env sh | |
| # 监听 | |
| #watchify -t coffeeify --extension='.coffee' -dv \ | |
| #-e ./public/assets/coffee/components/uploadModal.coffee \ | |
| #-o ./public/dist/scripts/u.js | |
| # 监听 + 分离 |
This file contains hidden or 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
| /* bling.js */ | |
| window.$ = document.querySelectorAll.bind(document) | |
| Node.prototype.on = window.on = function (name, fn) { | |
| this.addEventListener(name, fn) | |
| } | |
| NodeList.prototype.__proto__ = Array.prototype | |
This file contains hidden or 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
| fs = require 'fs' | |
| path = require 'path' | |
| source = require 'vinyl-source-stream' | |
| buffer = require 'vinyl-buffer' | |
| stream = require 'vinyl-to-stream' | |
| watchify = require 'watchify' | |
| browserify = require 'browserify' | |
| defaultOptions = |
This file contains hidden or 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
| .PHONY: compile | |
| time=/usr/bin/time | |
| compile: dart typescript coffeescript haxe jsx | |
| dart: | |
| $(time) dart2js -ooutput/dart.js source/simple.dart | |
| typescript: |
This file contains hidden or 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
| doc = document | |
| $$ = doc.querySelectorAll.bind(doc) | |
| NodeList::__proto__ = Array:: | |
| genParam = -> '?_=' + Date.now() | |
| getXHR = (url) -> | |
| xhr = new XMLHttpRequest | |
| xhr.open 'GET', url | |
| xhr |
This file contains hidden or 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
| var a = "60o0749460o07134482"; | |
| //var b= parseInt(a, 10); | |
| G = function(a, b) { | |
| var c = function(a) { | |
| for (var b, c = [], d = 3, e = function(a) { | |
| return a >= "0" && "9" >= a ? parseInt(a, 10) : a.charCodeAt(0) - "a".charCodeAt(0) + 10 | |
| }, f = function(a, b) { | |
| var c, d, f, g, h; | |
| //c =e 函数 | |
| return c = e(a[b]), d = e(a[b + 1]), d = 15 & d, f = (12 & c) >> 2, g = (2 & c) > 0, h = (1 & c) > 0, { |
This file contains hidden or 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
| React = @React or require 'react' | |
| win = window | |
| doc = win.document | |
| range = (length) -> Array.apply(null, {length}).map(Number.call, Number) | |
| randomInt = (min, max) -> Math.floor(Math.random() * (max - min + 1)) + min | |
| memoized = (fn) -> | |
| do (lookupTable = {}, key = undefined, value = undefined) -> | |
| -> |
This file contains hidden or 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
| React = @React or require? 'react' | |
| win = window | |
| doc = win.document | |
| # 业务逻辑变为 Mixin 方便复用 | |
| Mixin1 = | |
| getInitialState: -> | |
| title: @props.title | |
| name: '' | |
| count: 0 |
This file contains hidden or 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
| React = @React or require 'react' | |
| win = window | |
| doc = win.document | |
| class ExampleComponent extends React.Component | |
| mixins: [React.DOM] | |
| getInitialState: -> | |
| name: 'DC3' | |
| render: -> | |
| @div null, "hello world form react! #{@state.name}" |
This file contains hidden or 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
| testImgUrl = '//img.alicdn.com/tps/i4/TB1PVZoOpXXXXcKXXXXSutbFXXX.jpg' | |
| rgbToHex = (r, g, b) -> | |
| hex = (i) -> | |
| h = i.toString 16 | |
| h = '0' + h if h.length < 2 | |
| h | |
| ['#', hex(r), hex(g), hex(b)].join('') | |
| getOnePixelHex = (context, x, y, w = 1, h = 1) -> |