Книги:
From here: http://www.html5gamedevs.com/topic/9931-mobile-performance-tips-tricks/
P2:
- polygon shapes will be more expensive than simple circles - especially huge polygons (keep them simple)
- enabling p2 impactEvents is expensive - use onBeginContact instead
- having a bunchload of revolute constraints seems to be expensive
Arcade:
<?php | |
class compareImages | |
{ | |
private function mimeType($i) | |
{ | |
/*returns array with mime type and if its jpg or png. Returns false if it isn't jpg or png*/ | |
$mime = getimagesize($i); | |
$return = array($mime[0],$mime[1]); | |
switch ($mime['mime']) |
/** | |
* Uses Alan Moore's regexp: | |
* http://stackoverflow.com/questions/5312349/minifying-final-html-output-using-regular-expressions-with-codeigniter | |
* | |
* Replace `echo $kirby->launch();` in Kirby’s index.php by | |
* the following code to minify the HTML output | |
* (it leaves whitespace within `<pre>` and `<textarea>` tags untouched) | |
*/ | |
echo preg_replace( | |
'/(?>[^\S ]\s*|\s{2,})(?=(?:(?:[^<]++|<(?!\/?(?:textarea|pre)\b))*+) |
Icons have been part of applications since ages. Also most websites rely on icons. There were several ways to use them. First we used plain files then image sprites to reduce requests. Nowadays everyone uses icon fonts like font-awesome or glyphicons.
They are infinetly scaleable and styleable with css. The downside is they use pseudo elements for displaying. This is not only difficult to handle but also non-optimal for accessibilty.
A famous CSS-Tricks post brings SVG icons into play. The are also scalable and they behave like normal images. But we also want to have a sprite to not load any images seperatly and kill our servers and our sites performance. The proposed version is to create sprites with grunt or gulp using the symbol-trick. It's basically add every icon to a hidden sprite-image and give every icon an id-property.
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="beaker" viewBox="214.7 0 182.6 792">
<?php | |
/** | |
* File class | |
* | |
* @package Molajo | |
* @copyright 2013 Amy Stephen. All rights reserved. | |
* @license MIT, GPL v2 or later | |
*/ | |
namespace Molajo; |
var url = "http://cdn1.giltcdn.com/images/share/uploads/0000/0001/7250/172502872/420x560.jpg"; | |
var encoded = new Buffer(url).toString('base64'); | |
var decoded = new Buffer(encoded, 'base64').toString('ascii') | |
console.log(encoded); | |
console.log(decoded); |
var p1 = { | |
x: 20, | |
y: 20 | |
}; | |
var p2 = { | |
x: 40, | |
y: 40 | |
}; |
var myConfObj = { | |
iframeMouseOver : false | |
} | |
window.addEventListener('blur',function(){ | |
if(myConfObj.iframeMouseOver){ | |
console.log('Wow! Iframe Click!'); | |
} | |
}); | |
document.getElementById('YOUR_CONTAINER_ID').addEventListener('mouseover',function(){ |