This has been incorporated in a small library.
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 getRotationAngle(target) | |
| { | |
| const obj = window.getComputedStyle(target, null); | |
| const matrix = obj.getPropertyValue('-webkit-transform') || | |
| obj.getPropertyValue('-moz-transform') || | |
| obj.getPropertyValue('-ms-transform') || | |
| obj.getPropertyValue('-o-transform') || | |
| obj.getPropertyValue('transform'); | |
| let angle = 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
| // assumes you add a timestamp field to each record (see Firebase.ServerValue.TIMESTAMP) | |
| // pros: fast and done server-side (less bandwidth, faster response), simple | |
| // cons: a few bytes on each record for the timestamp | |
| var ref = new Firebase(...); | |
| ref.orderByChild('timestamp').startAt(Date.now()).on('child_added', function(snapshot) { | |
| console.log('new record', snap.key()); | |
| }); |
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
| (* | |
| Installation instructions | |
| ========================= | |
| Run as an Application: | |
| 1) Open AppleScript Editor and create a new script | |
| 2) Paste this file into it | |
| 3) Save name it '§(Toggle Wi-Fi)' | |
| - Or substitute '§' for a symbol that you can press with a single key | |
| 4) Put it in Applications/Utilities |
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 | |
| # http://jeffreysambells.com/2012/10/25/human-readable-filesize-php | |
| function human_filesize($bytes, $decimals = 2) { | |
| $size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB'); | |
| $factor = floor((strlen($bytes) - 1) / 3); | |
| return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor]; | |
| } | |
| echo human_filesize(filesize('example.zip')); |
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
| git branch -m old_branch new_branch # Rename branch locally | |
| git push origin :old_branch # Delete the old branch | |
| git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
- have PuTTY installed
- make sure you have installed PLink as a part of the installation process.
- open an elevated command prompt
- run the following command
plink.exe -L 3307:localhost:3306 [USERNAME]@[YOURSERVER.COM]
A multi-level groupBy for arrays inspired by D3's nest operator.
Nesting allows elements in an array to be grouped into a hierarchical tree
structure; think of it like the GROUP BY operator in SQL, except you can have
multiple levels of grouping, and the resulting output is a tree rather than a
flat table. The levels in the tree are specified by key functions.
See this fiddle for live demo.
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
| git fetch --all | |
| git reset --hard origin/master | |
| git pull origin master |
Let Google cache and resize your images.
Resized and Cached:
Original:
