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
| $sum = array_reduce($vals, create_function('$ret,$val','return $ret + $val[0];'), 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
| # Cross-Browser Split 1.0.1 for CoffeeScript | |
| # (c) Tsutomu Kawamura @OSSCafe; just converting to CoffeeScript | |
| # (c) Steven Levithan <stevenlevithan.com>; MIT License | |
| # An ECMA-compliant, uniform cross-browser split method */ | |
| if !cbSplit | |
| cbSplit = (str, separator, limit) -> | |
| # if `separator` is not a regex, use the native `split` | |
| return cbSplit._nativeSplit.call str, separator, limit if Object::toString.call(separator) isnt "[object RegExp]" | |
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
| SELECT | |
| creator, | |
| description, | |
| eid, | |
| end_time, | |
| event_subtype, | |
| event_type, | |
| hide_guest_list, | |
| host, | |
| location, |
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
| # [Filters] | |
| # thru filter | |
| class YinYang.filter | |
| constructor: (@args) -> | |
| process: (val) -> val | |
| # default filter | |
| # http://osscafe.github.com/yinyang/english/api.html#filter|default | |
| class YinYang.filters.default extends YinYang.filter | |
| process: (val) -> val || @args[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
| # [Filters] | |
| # thru filter | |
| class YinYang.filter | |
| constructor: (@args) -> | |
| process: (val) -> val | |
| # default filter | |
| # http://osscafe.github.com/yinyang/english/api.html#filter|default | |
| class YinYang.filters.default extends YinYang.filter | |
| process: (val) -> val || @args[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
| class TemplateVar extends Template | |
| constructor: (@parent = null, @value = '', @ignore = false) -> | |
| fs = @value.split '|' | |
| @value = fs.shift() | |
| @filters = (YinYang.createFilter f for f in fs) | |
| @children = [] | |
| display: (localValues) -> | |
| @localValues = localValues | |
| v = if @value[0] == '@' then @displayDom() else @displayVar() | |
| v = filter.process v for filter in @filters |
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
| re = | |
| pend: /<!--\{end\}-->/ | |
| more: /<!--\{more\}-->/ | |
| pvar: /<!--\{(@[a-zA-Z0-9_\.\#>=\[\]]+|[a-zA-Z][a-zA-Z0-9_\.]*)(\|.*?)*\}-->/ | |
| ivar: /\#\{(@[a-zA-Z0-9_\.\#>=\[\]]+|[a-zA-Z][a-zA-Z0-9_\.]*)(\|.*?)*\}/ | |
| loop: /<!--\{[a-zA-Z][a-zA-Z0-9_\.]* in (@[a-zA-Z0-9_\.\#>=\[\]]+|[a-zA-Z][a-zA-Z0-9_\.]*)\}-->/ | |
| if value.match re.pend then @ignore = false; @parent | |
| else if value.match re.more then @ignore = true; @ | |
| else unless @ignore | |
| if value.match re.pvar then @_add 'child', new TemplateVar @, value.replace(/<!--{|}-->/g, ''), true |
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
| zip -r Archive.zip TargetDirectory -x "*.DS_Store" |
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
| <?php | |
| /** | |
| * PDFファイルのリンクに、容量を記載するためのスクリプト | |
| * @author Tsutomu Kawamura <[email protected]> | |
| * @copyright Copyright (c) 2012, Tsutomu Kawamura | |
| */ | |
| /** | |
| * メイン | |
| */ |
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 byte2str($size){ | |
| $kb=1024; | |
| $mb=1048576; | |
| $gb=1073741824; | |
| $tb=1099511627776; | |
| if(!$size) return '0 B'; | |
| elseif($size<$kb) return $size.' B'; | |
| elseif($size<$mb) return round($size/$kb, 0).' KB'; | |
| elseif($size<$gb) return round($size/$mb, 2).' MB'; | |
| elseif($size<$tb) return round($size/$gb, 2).' GB'; |