Skip to content

Instantly share code, notes, and snippets.

View aach's full-sized avatar
🏠
Working from home

Alex Alvarez aach

🏠
Working from home
View GitHub Profile
@aach
aach / devtools.md
Last active September 30, 2017 16:53
DevTools Shortcuts
  • Open Element Inspector ⌘⌥I
  • Open Console ⌘⌥J
  • Search file in sources ⌘O
  • Search a word in all files ⌘⌥F
  • Change dock position ⌘⌥D
  • Toggle console ESC
  • Toggle mobile emulation ⌘⌥M
  • Clear console ⌘K
  • Execute snippet ⌘⏎
var http = require( 'http' );
http.createServer( function ( request, response ) {
response.setHeader( 'Content-Type', 'text/html; charset=UTF-8' );
response.setHeader( 'Transfer-Encoding', 'chunked' );
response.write( 'Hello ' );
setTimeout( function ()
{
@aach
aach / jstestdriver_bodyTest.js
Created June 14, 2013 09:33
Test how document body is cleaned/shared between tests and testcases
( function ( doc )
{
var BODY_ID = 'batman',
fpCommonSetUp = function ()
{
/*:DOC += <span class="batman"></span> */
};
TestCase( 'is body restored between tests?', {
setUp: function ()
var oStrongWithoutWrapper = ( function ( doc )
{
function createStrongWithWrapper()
{
var oStrong = doc.createElement('strong');
oStrong.innerHTML = 'ola k ase'
return doc.createDocumentFragment()
function async( fn )
{
window.setTimeout( fn, 0 );
}
function problem()
{
for( var i = 0; i < 10; i++ )
{
async( function ()
@aach
aach / avoid_spam_in_mailto.js
Created May 18, 2013 15:30
Avoid spam in the mail with a mailto link
(function(){
var mailLink = document.getElementById( 'mail' ),
fullName = [ 'alex', 'alvarez', 'chinchilla' ];
mailLink.href = 'mailto:' + fullName.join( '.' ) + '@gmail.com';
}());