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
| /** | |
| * Polyfill for function bind | |
| * | |
| * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind | |
| */ | |
| if (!Function.prototype.bind) Function.prototype.bind = function (oThis) { | |
| if (typeof this !== "function") | |
| throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); | |
| var aArgs = Array.prototype.slice.call(arguments, 1), | |
| fToBind = this, |
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
| /** | |
| * iPad opacity test | |
| */ | |
| body { | |
| background: #f06; | |
| background: linear-gradient(45deg, #f06, yellow); | |
| -webkit-overflow-scrolling: touch; | |
| min-height: 100%; | |
| } | |
| li { |
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
| /** | |
| * Kohler | |
| */ | |
| body { | |
| background: #d0d0d0; | |
| min-height: 100%; | |
| font-family: sans-serif; | |
| } | |
| ul { |
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
| /** | |
| * Polyfill for forEach array iteration function | |
| * | |
| * @see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach | |
| */ | |
| if (!Array.prototype.forEach) { | |
| Array.prototype.forEach = function forEach(callback, thisArg) { | |
| var T, k; | |
| if (this==null) | |
| throw new TypeError( "this is null or not defined" ); |
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 formatFilesize = function (size, decimals, system) { | |
| size = parseInt(size, 10) | |
| if (!decimals && decimals!==0) decimals = 1 | |
| if (!system) system = 'decimal' | |
| var fileSizes = { | |
| decimal: ['Byte', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], | |
| binary: ['Byte', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'], | |
| } | |
| var base = system=='decimal' ? 1000 : 1024 | |
| var steps = Math.floor(Math.log(size) / Math.log(base)) |
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 () { | |
| var mouse = { x: 0, y: 0 }; | |
| document.addEventListener('mousemove', function (event) { | |
| mouse.x = (event.clientX || event.pageX)/window.innerWidth; | |
| mouse.y = (event.clientY || event.pageY)/window.innerHeight; | |
| }, false); | |
| // shim layer with setTimeout fallback | |
| // @see http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| var requestAnimFrame = (function(){ | |
| return window.requestAnimationFrame || |
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 | |
| function format_filesize($size, $decimals=1, $system='decimal') { | |
| $size = intval($size); | |
| $fileSizes = array( | |
| 'decimal' => array('Byte', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'), | |
| 'binary' => array('Byte', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB') | |
| ); | |
| for ($n=0; $size>($system=='decimal'?1000:1024); $n++) | |
| $size = $size/($system=='decimal'?1000:1024); | |
| return round($size, $decimals).' '.$fileSizes[$system][$n]; |
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 build-titanium() { | |
| if [ ! -f tiapp.xml ]; then | |
| echo "File tiapp.xml not found." | |
| else | |
| echo "Parsing tiapp.xml." | |
| outputDir="./dist" | |
| oldNodeVersion=$(node -v | sed "s/v//") | |
| buildAndroid=$(grep -c "<target device=\"android\">true</target>" tiapp.xml) | |
| buildiPad=$(grep -c "<target device=\"ipad\">true</target>" tiapp.xml) | |
| buildiPhone=$(grep -c "<target device=\"iphone\">true</target>" tiapp.xml) |
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
| public enum FileSizeSystem { Decimal, Binary } | |
| public static string FormatFilesize (int Size) { return FormatFilesize(Size, 1, FileSizeSystem.Decimal); } | |
| public static string FormatFilesize (int Size, int Decimals) { return FormatFilesize(Size, Decimals, FileSizeSystem.Decimal); } | |
| public static string FormatFilesize (int Size, FileSizeSystem System) { return FormatFilesize(Size, 1, System); } | |
| public static string FormatFilesize (int Size, int Decimals, FileSizeSystem SizeSystem) { | |
| float OutputSize = (float)Size; | |
| string[] Units; | |
| switch (SizeSystem) { | |
| case FileSizeSystem.Binary: | |
| Units = new string[]{ "Byte", "kiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB" }; |
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
| enum FileSizeSystems { | |
| Decimal = 'decimal', | |
| Binary = 'binary', | |
| } | |
| const formatFilesize = (size: number, decimals: number = 1, system: FileSizeSystems = FileSizeSystems.Decimal): string => { | |
| const fileSizes = { | |
| [FileSizeSystems.Decimal]: ['Byte', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], | |
| [FileSizeSystems.Binary]: ['Byte', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'], | |
| } | |
| const base = { |
OlderNewer