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
| /* 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
| #!/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
| JSONP = do (win = window, doc = document) -> | |
| head = doc.getElementsByTagName('head')[0] | |
| createScript = (url) -> | |
| node = doc.createElement('script') | |
| node.onload = -> head.removeChild node | |
| node.onerror = -> | |
| head.removeChild node | |
| throw new Error 'JSONP load script error' | |
| node.src = url |
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
| #!/bin/sh | |
| # Convert Markdown to Confluence | |
| # | |
| # Supported syntax | |
| # * heading (1-6) | |
| # * blockquote (only single line ".bq") | |
| # * code block fence (```) | |
| # * inline code (`foo`) | |
| # * link ([name](url)) |
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
| do -> | |
| hasPromise = (window.Promise and window.Promise.all) | |
| hasjQuery = (($ = window.jQuery) and window.jQuery.fn.jquery) | |
| return if hasPromise or not hasjQuery | |
| Promise = (func) -> | |
| $.Deferred(({resolve, reject}) -> | |
| func.call null, resolve, reject | |
| ).promise() | |
| Promise.all = (arr) -> new Promise (resolve, reject) -> | |
| if Object::toString.call(arr) isnt '[object Array]' |
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
| do (win = window, doc = window.document, className = 'wrap-placeholder', selector = '[placeholder]') -> | |
| # support placeholder | |
| return if doc.createElement('input').placeholder isnt undefined | |
| modern = doc.addEventListener | |
| setStyles = (node, styles) -> | |
| console.log 'debug', JSON.stringify styles | |
| for name, val of styles | |
| console.log 'debug', [name, val] | |
| node.style[name] = val |
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
| function base64image() { | |
| if [ -z "$1" ] | |
| then | |
| echo "give me a filename" | |
| fi | |
| filename=$(basename "$1") | |
| extension="${filename##*.}" | |
| out="$filename.base64" | |
| str=$(base64 --wrap=0 "$1") | |
| echo "data:image/$extension;base64,$str" | cat > "$out" |
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
| # 兼容 jQuery Deferred 与 ES6 Promise 的写法的 Promise Wrapper | |
| # https://gist.github.com/DC3/d2c37399eae2f7f08d16 | |
| do -> | |
| hasPromise = (window.Promise and window.Promise.all) | |
| hasjQuery = (($ = window.jQuery) and window.jQuery.fn.jquery) | |
| return if hasPromise or not hasjQuery | |
| Promise = (func) -> | |
| $.Deferred(({resolve, reject}) -> | |
| func.call null, resolve, reject | |
| ).promise() |