viernes, 27 de diciembre de 2013

HTML Parser with Javascript

parse5

parse5 (GitHub: inikulin / parse5, License: MIT, npm: parse5) by Ivan Nikulin is a new HTML5 parser, based on the WhatWG HTML5 standard. It was built for a commercial project called TestCafé, when the authors found other HTML5 parsers to be too slow or inaccurate.

It’s used like this:

var Parser = require('parse5').Parser;
var parser = new Parser();
var document = parser.parse('<!DOCTYPE html><html><head></head><body>Hi there!</body></html>')
var fragment = parser.parseFragment('<title>Parse5 is &#102;&#117;&#99;&#107;ing awesome!</title><h1>42</h1>');

I had a look at the source, and it doesn’t look like it was made with a parser generator. It has a preprocessor, tokenizer, and special UTF-8 handling. There are no dependencies, other than nodeunit for testing. The tests were derived from html5lib, and include over 8000 test cases.
If you wanted to use it, you’ll probably need to write a “tree adapter”. Ivan has included an example tree adapter, which reminds me of writing SAX parser callbacks.
Ivan also sent in mods, which is a module system designed to need less boilerplate than AMD-style libraries.

Redis Time Series

Tony Sokhon sent in redis-timeseries (GitHub: tonyskn / node-redis-timeseries, License: MIT, npm: redis-timeseries), a project for managing time series data. I’ve used Redis a few times as a data sink for projects that need realtime statistics, and I always found it worked well for the modest amounts of data my projects generated. This project gives things a bit more structure – you can create instances of time series and then record hits, then query them later.
A time series has a granularity, so you can store statistics at whatever resolution you require: ts.getHits('your_stats_key', '1second', ts.minutes(3), callback). This module is used by Tony’s dashboard project, which can be used to make a realtime dashboard.

request-as-curl

request-as-curl (GitHub: azproduction / node-request-as-curl, License: BSD, npm: request-as-curl) by Mikhail Davydov serialises options for http.ClientRequest into an equivalent curl command. It also works for Express.

// http.ClientRequest:
var req = request('http://google.com/', {method: 'POST', json: data}, function (error, response, expected) {
  curlify(req.req, data);
  // curl 'http://google.com' -H 'accept: application/json' -H 'content-type: application/json' -H 'connection: keep-alive' --data '{"data":"data"}' --compressed
});

// Express:

app.get('/', function (req) {
  curlify(req);
  // curl 'http://localhost/pewpew' -H 'x-real-ip: 127.0.0.1' -H etc...
});

I imagine Mikhail has been using this so he can replicate requests based on logs to aid in debugging.

Thanks to: http://dailyjs.com/2013/12/11/node-roundup/

jueves, 26 de diciembre de 2013

ionic - HTML5 native app Framework

Ionic is a powerful HTML5 native app development framework that helps you build native-feeling mobile apps all with web technologies like HTML, CSS, and Javascript. Ionic is focused mainly on the look and feel, and UI interaction of your app.

Ionic is free and open source, built with Sass and optimized for AngularJS. It is modeled off of popular native mobile development SDKs, making it easy to understand for anyone that has built a native app for iOS or Android. Just drop it in your code to get going, and push through PhoneGap when it’s ready. Develop once, deploy everywhere.

ionic
Requirements: -
Demo: http://ionicframework.com/
License: MIT License

Read more at http://www.webappers.com/2013/11/25/pretty-frontend-framework-for-mobile-apps-in-html5/#QrHY1shtsocLWHKu.99

Effeckt.css - HTML Page Transitions

Designing and developing UIs for the mobile web is tricky, but it’s extremely difficult to do that while delivering something that performs at 60fps. The best opportunities to getting jank-free transitions on phones/tablets are CSS transition and keyframe animation based, especially tapping into hardware-accelerated transforms and opacity changes.

Effeckt.css is a collection of  fantastic experiments and demos exploring CSS-based transitions. It provides very little UI of its own. It’s only hooks for transitions / animations. There is no hover on the mobile web, so any hover-based effects would be excluded or have a tap equivalent.

css-transitions
Requirements: JavaScript Framework
Demo: http://h5bp.github.io/Effeckt.css/dist/
License: MIT License

Read more at http://www.webappers.com/2013/12/09/effeckt-css-ui-less-fast-transitions-animations/#y8sEHvS5ehEl9Ttp.99

Create 3D with jQuery


Incredible plugin for rotating images in 3D with javascript only.
http://www.thepetedesign.com/demos/interactive_3d.html

Appear.in - Group hat (sign-up free)

When working as a distributed team or meeting remotely with clients, video chat is used frequently.
Appear.in is a free and web-based app that provides group video chat for up to 8 people.
The application doesn’t require sign-up, a room with a unique link can be created instantly and shared with others.
Appear.in
It is built with native web technologies, no download is needed and works on all browsers except IE.
There is also an API which may simplify integrating it to the project management cycle with ease.

http://www.webresourcesdepot.com/free-group-video-chats-appear-in/

Marvel - Create prototypes for your apps

Marvel is a free, web-based tool for creating prototypes for any device: desktop, tablet, mobile and more.
The app works by synchronizing with your Dropbox account which simplifies updates (as local file updates are instantly reflected to the Marvel-powered prototypes).
It accepts both images + PSDs and prototypes can be shared with unique URLs, SMS or QR codes.
Marvel Prototyping App

Summernote - A simple WYSIWYG

Summernote is a simple, clean and flexible WYSIWYG Editor that is built on top of jQuery and Bootstrap.
It supports Bootstrap’s both active versions (2 and 3) and has keyboard shortcuts for all major tasks.
Summernote WYSIWYG Editor
There is a powerful API which provides lots of customization options in means of design (width, height, active items..) and functionality.
The project also has integration samples for major scripting languages or frameworks (PHP, Ruby, Django, Nodejs).

UIKit - Create web content with CSS

UIKit

UIKit 2.0
UIKit 2.0 (GitHub: uikit / uikit, License: MIT) is a frontend framework that provides components for layout, navigation, and more complex UI widgets like dropdown replacements. It uses jQuery and FontAwesome. Version 2 has just been released, which has some new features including a Markdown editor that supports syntax highlighting and an extensible toolbar.

There’s extensive documentation and a theme tool, so you can have a look at the main features quite easily

HTML Game for the Weekend

Just for playing, I did a small game in pure HTML. But not using the usual <canvas> from HTML5. I used only pure old Javascrip and a couple of HTML tags.

All goes inside index.html
You first create a simple HTML file with the following:

<body onLoad="doWork()">
<div id="canvas"></div>
</body>

Make a reference to mousetrap.min.js to handle the keyboard events (Google the library, it's pretty cool)

<!-- http://craig.is/killing/mice -->
<script type="text/javascript" src="mousetrap.min.js"></script>

For the <style>, this is what I did (pretty basic)

<style>
.tile {
border : 1px dotted #ccc;
width: 10px;
height: 10px;
position: fixed;
}
.marked {
background-color: #ccc;
}
</style>

The fun part is the Javascript code.

<script>
//
// TILES
//
var totalCols = 100;
var totalRows = 50;
//
// TILES POSITION AND SIZE
//
var grid_x = 0;
var grid_y = 0;
var grid_w = 10;
var grid_h = 10;
//
// SPEED FOR MOVING ACTORS
//
var speed_w = grid_w * 1;
var speed_h = grid_h * 1;
//
// MARKED TILES ARE OBSTACLES FOR ACTORS
//
var totalMarkedTiles = 0;
var markedTilesLeft = new Object();
var markedTilesTop = new Object();
//
// FRAMES LEFT
//
var framesLeftKid = new Object();
framesLeftKid['0'] = 'i/kid/frame_000.gif';
framesLeftKid['w'] = grid_w * 6;
framesLeftKid['h'] = grid_h * 10;
//
// FRAMES RIGHT
//
var framesRightKid = new Object();
framesRightKid['0'] = 'i/kid-right/frame_000.gif';
framesRightKid['w'] = grid_w * 6;
framesRightKid['h'] = grid_h * 10;
//
// ACTORS
//
var actorKid1 = new Object();
actorKid1['name'] = 'kid1';
actorKid1['framesLeft'] = framesLeftKid;
actorKid1['framesRight'] = framesRightKid;
actorKid1['currentTop'] = 20;
actorKid1['currentLeft'] = 20;
actorKid1['currentFrame'] = 0;
//
// ACTORS ADDED TO THE MAIN ARRAY
//
var actors = new Object();
actors[0] = actorKid1;
function loadMap() {
var top = grid_y;
var left = grid_x;
var str = "";
for ( var row=0; row < totalRows; row++ ) {
for ( var col=0; col < totalCols; col++ ) {
// all the bottom is blocked
if ( col >= 0 && row == totalRows - 1 && col <= totalCols - 1 ) {
markedTilesLeft[totalMarkedTiles] = col;
markedTilesTop[totalMarkedTiles] = row;
totalMarkedTiles ++;
}
// first row is blocked
if ( col >= 0 && row == 0 && col <= totalCols - 1 ) {
markedTilesLeft[totalMarkedTiles] = col;
markedTilesTop[totalMarkedTiles] = row;
totalMarkedTiles ++;
}
// first col is blocked
if ( col == 0 && row >= 0 && row <= totalRows - 1 ) {
markedTilesLeft[totalMarkedTiles] = col;
markedTilesTop[totalMarkedTiles] = row;
totalMarkedTiles ++;
}
// last col is blocked
if ( col == totalCols - 1 && row >= 0 && row <= totalRows - 1 ) {
markedTilesLeft[totalMarkedTiles] = col;
markedTilesTop[totalMarkedTiles] = row;
totalMarkedTiles ++;
}
if ( col == 5 && row == 30 ) {
markedTilesLeft[totalMarkedTiles] = col;
markedTilesTop[totalMarkedTiles] = row;
totalMarkedTiles ++;
}
if ( col == 50 && row == 5 ) {
markedTilesLeft[totalMarkedTiles] = col;
markedTilesTop[totalMarkedTiles] = row;
totalMarkedTiles ++;
}
if ( col == 60 && row == 40 ) {
markedTilesLeft[totalMarkedTiles] = col;
markedTilesTop[totalMarkedTiles] = row;
totalMarkedTiles ++;
}
}
}
}
function drawGrid() {
var top = grid_y;
var left = grid_x;
var str = "";
for ( var row=0; row < totalRows; row++ ) {
for ( var col=0; col < totalCols; col++ ) {
var painted = false;
for ( var m=0; m < totalMarkedTiles; m++ ) {
if ( markedTilesLeft[m] == col && markedTilesTop[m] == row ) {
str += "<div id=" + row + "_" + col 
+ " style='border:1px dotted #ccc; " 
+ "position:fixed; " 
+ "width:" + grid_w + "px; " 
+ "height:" + grid_h + "px; " 
+ "left:" + left + "px; " 
+ "top:" + top + "px; " 
+ "background:#ccc; ' " 
+ "/>";
painted = true;
}
}
if ( painted == false ) {
str += "<div id=" + row + "_" + col 
+ " style='border:1px dotted #ccc; " 
+ "position:fixed; " 
+ "width:" + grid_w + "px; " 
+ "height:" + grid_h + "px; " 
+ "left:" + left + "px; " 
+ "top:" + top + "px;' " 
+ "/>";
}
left += grid_w;
}
top += grid_h;
left = grid_x;
}
document.getElementById('canvas').innerHTML = str;
}
function drawAllActors() {
var str = "";
for (var actor in actors) {
var a = actors[actor];
var f = a['framesLeft'];
var top = a['currentTop']; 
var left = a['currentLeft']; 
var w = f['w'];
var h = f['h'];
str += "<div id='" + a['name'] + "' " 
+ "style='left:" + left 
+ "px; top:" + top + "px; position:fixed; " 
+ "width:" + w + "px; " 
+ "height:" + h + "px; " 
+ "border:1px solid #333;" 
+ "' " 
+ ">";
}
document.getElementById('canvas').innerHTML += str;
}
function moveActorDown(index, newTop, callback) {
var a = actors[index];
var f = a['framesLeft'];
var top = a['currentTop']; 
var left = a['currentLeft']; 
var w = f['w'];
var h = f['h'];
var e = document.getElementById(a['name']);
for ( var m=0; m < totalMarkedTiles; m++ ) {
var markedLeft = (markedTilesLeft[m] * grid_w);
var markedTop = (markedTilesTop[m] * grid_h);
var markedW = grid_w;
var markedH = grid_h;
if ( markedLeft >= left && markedLeft + markedW  <= left + w 
&& markedTop >= newTop && markedTop + markedH <= newTop + h ) 
{
if ( callback != null ) callback(false);
return false;
}
}
e.style.top = newTop + "px";
a['currentTop'] = newTop;
actors[index] = a;
if ( callback != null ) callback(true);
return true;
}
function moveActorUp(index, newTop, callback) {
var a = actors[index];
var f = a['framesLeft'];
var top = a['currentTop']; 
var left = a['currentLeft']; 
var w = f['w'];
var h = f['h'];
var e = document.getElementById(a['name']);
for ( var m=0; m < totalMarkedTiles; m++ ) {
var markedLeft = (markedTilesLeft[m] * grid_w);
var markedTop = (markedTilesTop[m] * grid_h);
var markedW = grid_w;
var markedH = grid_h;
if ( markedLeft >= left && markedLeft + markedW  <= left + w 
&& markedTop >= newTop && markedTop + markedH <= newTop + h ) 
{
if ( callback != null ) callback(false);
return false;
}
}
e.style.top = newTop + "px";
a['currentTop'] = newTop;
actors[index] = a;
if ( callback != null ) callback(true);
return true;
}
function moveActorLeft(index, newLeft, callback) {
var a = actors[index];
var f = a['framesLeft'];
var top = a['currentTop']; 
var left = a['currentLeft']; 
var w = f['w'];
var h = f['h'];
var e = document.getElementById(a['name']);
for ( var m=0; m < totalMarkedTiles; m++ ) {
var markedLeft = (markedTilesLeft[m] * grid_w);
var markedTop = (markedTilesTop[m] * grid_h);
var markedW = grid_w;
var markedH = grid_h;
if ( markedLeft >= newLeft && markedLeft + markedW  <= newLeft + w 
&& markedTop >= top && markedTop + markedH <= top + h ) 
{
if ( callback != null ) callback(false);
return false;
}
}
e.style.left = newLeft + "px";
a['currentLeft'] = newLeft;
actors[index] = a;
if ( callback != null ) callback(true);
return true;
}
function moveActorRight(index, newLeft, callback) {
var a = actors[index];
var f = a['framesLeft'];
var top = a['currentTop']; 
var left = a['currentLeft']; 
var w = f['w'];
var h = f['h'];
var e = document.getElementById(a['name']);
for ( var m=0; m < totalMarkedTiles; m++ ) {
var markedLeft = (markedTilesLeft[m] * grid_w);
var markedTop = (markedTilesTop[m] * grid_h);
var markedW = grid_w;
var markedH = grid_h;
if ( markedLeft >= newLeft && markedLeft + markedW  <= newLeft + w 
&& markedTop >= top && markedTop + markedH <= top + h ) 
{
if ( callback != null ) callback(false);
return false;
}
}
e.style.left = newLeft + "px";
a['currentLeft'] = newLeft;
actors[index] = a;
if ( callback != null ) callback(true);
return true;
}
function moveActorDownUntilCollide(index, callback) {
var a = actors[index];
var f = a['framesLeft'];
var top = a['currentTop']; 
var left = a['currentLeft']; 
var w = f['w'];
var h = f['h'];
var newTop = top + speed_h;
moveActorDown(index, newTop, function(result) {
if (result) {
moveActorDownUntilCollide(index, callback);
}
else {
callback();
}
});
}
function moveActorUpUntilCollide(index, callback) {
var a = actors[index];
var f = a['framesLeft'];
var top = a['currentTop']; 
var left = a['currentLeft']; 
var w = f['w'];
var h = f['h'];
var newTop = top - speed_h;
moveActorUp(index, newTop, function(result) {
if (result) {
moveActorUpUntilCollide(index, callback);
}
else {
callback();
}
});
}
function moveActorRightUntilCollide(index, callback) {
var a = actors[index];
var f = a['framesLeft'];
var top = a['currentTop']; 
var left = a['currentLeft']; 
var w = f['w'];
var h = f['h'];
var newLeft = left + speed_w;
moveActorRight(index, newLeft, function(result) {
if (result) {
moveActorRightUntilCollide(index, callback);
}
else {
callback();
}
});
}
function moveActorLeftUntilCollide(index, callback) {
var a = actors[index];
var f = a['framesLeft'];
var top = a['currentTop']; 
var left = a['currentLeft']; 
var w = f['w'];
var h = f['h'];
var newLeft = left - speed_w;
moveActorLeft(index, newLeft, function(result) {
if (result) {
moveActorLeftUntilCollide(index, callback);
}
else {
callback();
}
});
}
function onKeyPressed(keyCode) {
var a = actors[actorIndex];
var f = a['framesLeft'];
var top = a['currentTop']; 
var left = a['currentLeft']; 
var w = f['w'];
var h = f['h'];
if ( keyCode == 'left' ) {
moveActorLeft(actorIndex, left - speed_w, function() {
setTimeout( function() {
moveActorDownUntilCollide(actorIndex, function() {})
}, 500);
});
}
if ( keyCode == 'right' ) {
moveActorRight(actorIndex, left + speed_w, function() {
setTimeout( function() {
moveActorDownUntilCollide(actorIndex, function() {})
}, 500);
});
}
if ( keyCode == 'up' ) {
moveActorUp(actorIndex, top - speed_h, function() {
setTimeout( function() {
moveActorDownUntilCollide(actorIndex, function() {})
}, 500);
});
}
if ( keyCode == 'down' ) {
moveActorDown(actorIndex, top + speed_h, function() {
setTimeout( function() {
moveActorDownUntilCollide(actorIndex, function() {})
}, 500);
});
}
}
function initKeyboard() {
Mousetrap.bind('esc', function(e) {
e.preventDefault();
onKeyPressed('esc');
return false;
});
Mousetrap.bind('up', function(e) {
e.preventDefault();
onKeyPressed('up');
return false;
});
Mousetrap.bind('down', function(e) {
e.preventDefault();
onKeyPressed('down');
return false;
});
Mousetrap.bind('left', function(e) {
e.preventDefault();
onKeyPressed('left');
return false;
});
Mousetrap.bind('right', function(e) {
e.preventDefault();
onKeyPressed('right');
return false;
});
}
function doWork() {
initKeyboard();
loadMap();
drawGrid();
drawAllActors();
// the only actor can not be floating...
moveActorDownUntilCollide(actorIndex, function() {})
}
// this is the only actor index we use in this demo
var actorIndex = 0;
</script>

That's it. Put all that inside an index.html and use your arrow keys in your keyboard to move the actor.


martes, 24 de diciembre de 2013

Vbukit: My last project

Just to let you know that you can share all your content for free and 100% private using Vbukit.

This is a project I've been working for the past months and now is ready for beta testing.

From your Android or iPhone you can share your content to any TV without installing any other software or making any complicated connection. Just go to http://vbukit.tv and that's it.

You will love the idea because you can share long movies, songs or Office documents directly from your Dropbox account to your TV with only a couple of taps in your phone.

Download from Google Play or Apple Store (search "vbukit")
Go to http://vbukit.tv from your Smart TV

Sign our petition to be accepted as an official Chromecast app:
http://www.youtube.com/watch?v=S8ByLPXHnP8


lunes, 9 de diciembre de 2013

ERR_NAME_RESOLUTION_FAILED Chrome error

Command:
netsh winsock reset

This is what (for me) worked for cleaning my DNS records in Windows.
Thanks to these guys.

sábado, 16 de noviembre de 2013

Google Chars New API - Getting QR Codes

The old API for creating QR codes is deprecated. Here I let you the new one. And the way to get it via POST so you can get a PNG and not any HTML file (as they used to do)

https://developers.google.com/chart/image/docs/post_requests

Create QR Codes

<form action='https://chart.googleapis.com/chart' method='POST'>
    <input type="hidden" name="cht" value="qr"  />
    <input type='hidden' name='chs' value='300x200' />
    <input type="hidden" name="chl" value="What you want inside your QR" />
    <input type='hidden' name='chld' value='H|0=absolute'/>
    <input type="submit"  />
</form> 


viernes, 8 de noviembre de 2013

Google modernizes Octane JavaScript speed test | Internet & Media - CNET News

Google modernizes Octane JavaScript speed test | Internet & Media - CNET News

I like the idea of a faster engine but sometimes -when I do Javascript code for different browser- I prefer to see all these big boys worrying more about how they can be more equals on their interpreters ;-)


martes, 5 de noviembre de 2013

ConvertAPI - Web2Image and more...

This website has a lot of conversion utilities. The one I'm using right now is the one converting webpages to image files.

http://www.convertapi.com/web-image-api

This API will let you do this task in a very easy way. Try their sample:

<h3>Convert web page and return JPG image as stream</h3>
<a href="http://do.convertapi.com/web2image?curl=http://www.google.com">http://do.convertapi.com/web2image?curl=http://www.google.com</a>

http://jsfiddle.net/tomasr/eGhgT/

ConvertAPI - file conversion to PDF API SDK for Python Ruby Java .NET C# PHP Shell Delphi

AJAX Cross Domain - Library

AJAX Cross Domain is a free library that allows to perform AJAX requests between different domains.

topSynopsis
<script type="text/javascript" src="http://www.ajax-cross-domain.com/cgi-bin/ACD/ACD.js?uri=(http://www.google.com)"></script> <script type="text/javascript"> alert(ACD.responseText); </script>


topMotivation
Virtually all modern server-side scripting languages support remote requests in one or another form. In client-side javascript, this functionality is not present due to the Same Origin Policy. Though this policy is necessary for a robust security model, programmers are often handicapped in their wish to send and retrieve requests to remote servers. During the last years, several proposals have been made for a more flexible (re-)design of the XMLHttpRequest object, which is the core mechanism of all AJAX based technologies. AJAX Cross Domain provides in the full functionality of the XMLHttpRequest object in a similar syntax, and can by extent handle all cross-domain requests. The core engine of AJAX Cross Domain is written in Perl and outputs its content as ajavascript file.

topExamples
All code blocks are fully working cut-and-paste examples and can be directly used in your own test pages.
This example alerts the response body of an URL with a query-string:

<script type="text/javascript" src="http://www.ajax-cross-domain.com/cgi-bin/ACD/ACD.js?uri=(http://216.92.131.147/dotserv/ACD/?name=john)"></script> <script type="text/javascript"> alert(ACD.responseText); </script>

This example does a remote request and shows all the response headers:
<script type="text/javascript" src="http://www.ajax-cross-domain.com/cgi-bin/ACD/ACD.js?uri=(http://www.google.com/)"></script> <script type="text/javascript"> alert(ACD.getAllResponseHeaders); </script>

This example returns only a specific header of interest:
<script type="text/javascript" src="http://www.ajax-cross-domain.com/cgi-bin/ACD/ACD.js?uri=(http://www.google.com/)"></script> <script type="text/javascript"> if (ACD.getResponseHeader['Content-Type']) { alert(ACD.getResponseHeader['Content-Type']); } </script>

This example returns the HTTP status code of the response:
<script type="text/javascript" src="http://www.ajax-cross-domain.com/cgi-bin/ACD/ACD.js?uri=(http://www.microsoft.com/)"></script> <script type="text/javascript"> alert(ACD.status); </script>

This example performs a POST request to the given URI and shows the request how it was offered to the remote resource:
<script type="text/javascript" src="http://www.ajax-cross-domain.com/cgi-bin/ACD/ACD.js?uri=(http://216.92.131.147/dotserv/ACD/runit/post.cgi)&amp;method=post&amp;postdata=(name=fred&amp;email=fred@fred.com)"></script> <script type="text/javascript"> alert(ACD.responseText); </script>

If postdata is present, it is assumed that the request method is meant as post even when method=post is not explicitly mentioned. The following example performs a (somewhat more complex percent-encoded) POST-request and returns the response body:
<script type="text/javascript" src="http://www.ajax-cross-domain.com/cgi-bin/ACD/ACD.js?uri=(http://216.92.131.147/dotserv/ACD/runit/post.cgi)&amp;postdata=(name=John%20Johnson&amp;email=john@gmail.com&amp;company=C%26A%20%28until%20May%29&amp;sum=1%2B1%3D2)"></script> <script type="text/javascript"> alert(ACD.responseText); </script>

This example sends a request with header User-Agent set to My cool User-Agent and header Content-Language set to en, and shows the request that was offered to the remote server:
<script type="text/javascript" src="http://www.ajax-cross-domain.com/cgi-bin/ACD/ACD.js?uri=(http://www.google.com)&amp;headers=(User-Agent=My%20cool%20User-Agent&amp;Content-Language=en)"></script> <script type="text/javascript"> alert(ACD.request); </script>

This example generates an error because uri is invalid:
<script type="text/javascript" src="http://www.ajax-cross-domain.com/cgi-bin/ACD/ACD.js?uri=(http/www.google.com)"></script> <script type="text/javascript"> alert(ACD.error); </script>
 

AJAX Cross Domain - ACD

lunes, 4 de noviembre de 2013

Long Polling your Server

If you need to get content from your server and want to do it in an efficient way, so try this sample. It will inform only when changes occur on the server side. Simply magic :-)

Download tutorial files:
https://mega.co.nz/#!VlAwQBDK!EDWmshoVImeZk8YKJX83O29Wezga2hVso9v1Pn_oKg4

Link to a video tutorial:
Screenr - srcoley: A Simple Guide to Long Polling in 5 Minutes #nettuts

Javascript webpage to image

This guy is a genius! So I wanted to share with you this solution for capturing on client-size a full html page and convert it to image.

All solutions out there are doing this job but on the server side. And that could be a problem if you are planing to receive thousands of visits. So, by doing this on client-side, you can stop worrying ;-)

Link to the website: http://html2canvas.hertzen.com/screenshots.html
Download: https://github.com/niklasvh/html2canvas

sábado, 2 de noviembre de 2013

Tululoo, Game Engine para HTML5

Tululoo, para desarrollar juegos en HTML5

tululoo

Descubrimos vía Seetio a Tululoo Game Maker, una herramienta pensada para la creación de videojuegos en HTML5 basados en navegador y jugables desde dispositivos móviles, teniendo en cuenta que los smartphones más recientes soportan los últimos estándards de HTML5.
Tululoo nos ofrece varias herramientas para ello, como un manager de recursos y un editor de scripts con el que importar imágenes, fondos, sprites animados y sonidos así como la posibilidad de crear distintos objetos (coleccionables, personajes, enemigos, etc.) y funciones.

Obviamente, la herramienta nace orientada para aquellos que dispongan de nociones básicas o avanzadas de programación, pero en este caso la creación de código no será compleja ya que Tululoo cuenta con características como completar el código automáticamente o resaltar ciertas partes de la sintaxis, para que dentro de lo complejo el proceso se nos haga lo más fácil posible. Otras cosas que podremos ver en Tululoo serán detalles como soporte para archivos de audio WAV, MP3 y OGG, soporte para jugar con teclado, ratón y touchpad, creación de objetos en tiempo real, etc.

Si queréis ver algunos ejemplos de lo que puede llegar a desarrollarse con Tululoo, podéis acceder a diversos juegos desarrollados con la herramienta en la sección “Games“. Lo mejor de todo, dejando de lado lo útil que puede ser para desarrolladores independientes de videojuegos, es que la herramienta es gratuita (si nos encanta y queremos colaborar en su mantenimiento y desarollo, podemos realizar donaciones desde la misma página web).

Visto en: http://wwwhatsnew.com/2013/10/28/tululoo-para-desarrollar-juegos-en-html5/

jueves, 31 de octubre de 2013

PHP Webpage Capture

I always do some new research for capturing a snapshot of a webpage.
As always, I can find plenty of sites offering this service in exchange of a monthly payment... And today I found something new: A free site!

http://screen.microweber.com/shot.php?url=http://www.yahoo.com

Works really good and fast!

Well, it's not that you can use this server for free. This is obviously an experiment or a private use that I just discovered accidentally.

The good news is that this is based on a free library you can download and install in your server (sorry for those like Godaddy, don't have access to install specific applications. You should use your own computer as an Internet Server)

https://github.com/microweber/screen

Microweber (Usage)

  • Upload to your webserver
  • Make the bin executable chmod +x /var/www/html/screen/bin/phantomjs
  • Make your folder writable
  • Open your browser to index.php

API

You can directly render the taken screen-shot with the shot.php file
You can render any link as image by passing it as url parameter
shot.php?url=google.com
You can specify height and width: shot.php?url=google.com&w=300&h=100
If you want to crop/clip the screen shot, you can do so like this:shot.php?url=google.com&w=800&h=600&clipw=800&cliph=600

Demo

You can also set width and height, for example if you want to test how a page looks on small resolution.http://screen.microweber.com/shot.php?url=m.facebook.com&w=300&h=100

Dependencies

  • FontConfig must be installed - apt-get/yum install fontconfig
  • FreeType is also required - apt-get/yum install freetype*

PahntomJS
Is a library which runs an EXE file (for Windows. If you have Linux or MAc you can download the correspondant file)

Github download: https://github.com/microweber/screen

Cons:
1) If you don't define a background color, it will render it with black.
2) You need to run a program.

miércoles, 30 de octubre de 2013

jueves, 24 de octubre de 2013

Parsing URLs with the DOM! – James Padolsey

// This function creates a new anchor element and uses location
// properties (inherent) to get the desired URL data. Some String
// operations are used (to normalize results across browsers).
 
function parseURL(url) {
    var a =  document.createElement('a');
    a.href = url;
    return {
        source: url,
        protocol: a.protocol.replace(':',''),
        host: a.hostname,
        port: a.port,
        query: a.search,
        params: (function(){
            var ret = {},
                seg = a.search.replace(/^\?/,'').split('&'),
                len = seg.length, i = 0, s;
            for (;i<len;i++) {
                if (!seg[i]) { continue; }
                s = seg[i].split('=');
                ret[s[0]] = s[1];
            }
            return ret;
        })(),
        file: (a.pathname.match(/\/([^\/?#]+)$/i) || [,''])[1],
        hash: a.hash.replace('#',''),
        path: a.pathname.replace(/^([^\/])/,'/$1'),
        relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [,''])[1],
        segments: a.pathname.replace(/^\//,'').split('/')
    };
}

Usage

var myURL = parseURL('http://abc.com:8080/dir/index.html?id=255&m=hello#top');
 
myURL.file;     // = 'index.html'
myURL.hash;     // = 'top'
myURL.host;     // = 'abc.com'
myURL.query;    // = '?id=255&m=hello'
myURL.params;   // = Object = { id: 255, m: hello }
myURL.path;     // = '/dir/index.html'
myURL.segments; // = Array = ['dir', 'index.html']
myURL.port;     // = '8080'
myURL.protocol; // = 'http'
myURL.source;   // = 'http://abc.com:8080/dir/index.html?id=255&m=hello#top'

Parsing URLs with the DOM! – James Padolsey

domingo, 20 de octubre de 2013

Webnode lanza plantillas gratis para crear sitios móviles

webnode.com dispone de una colección de plantillas gratis que nos permiten ahora crear sitios web para este tipo de dispositivo.
webnode
Son plantillas gratis para la versión móvil de sus páginas web y blogs creadas para que las pequeñas y medianas empresas puedan aprovechar las nuevas oportunidades que ofrece el mercado. Nos comentan que más de la mitad de la población en España dispone ya de un teléfono con acceso internet, en México ya lo tienen 4 de cada diez personas (el doble que en 2012) y casi un tercio de la población argentina, números que muestran la importancia de invertir en esta plataforma, principalmente teniendo en cuenta la tendencia creciente de comprar productos o contactar con empresas usando el móvil.
Las nuevas plantillas tienen un menú optimizado para agilizar el acceso a la información dentro de la página e integran widgets de mapas de Google, vídeos y formularios. También se han preocupado en posicionar correctamente la publicidad, así como en alterar el tamaño de los componentes de forma inteligente.
Podemos también configurar la plantilla para facilitar el reconocimiento de números de teléfono y correos electrónicos:
Con solo tocar con el dedo sobre una de las formas de contacto, los teléfonos preguntarán a los usuarios si desean llamar o bien contactar por correo electrónico, agilizando así los procesos de contacto.
Webnode anunció en mayo que ya tenían 10 millones de usuarios. 6 meses más tarde nos comentan que el número ha llegado a los 15 millones, usuarios que ya consiguen crear sitios web desde la plataforma sin necesidad de tener conocimientos de programación, compitiendo directamente con soluciones como Wix.com.
Webnode lanza plantillas gratis para crear sitios móviles