Created
June 6, 2016 07:51
-
-
Save Inndy/f157c8a23e4bc1320610b63401fecc21 to your computer and use it in GitHub Desktop.
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 qrcode = ['111111100010101111111', '100000101010101000001', '101110101011001011101', '101110100000101011101', '101110101111101011101', '100000101110001000001', '111111101010101111111', '000000001', '11010011001110111011', '111000010111000000011', '000101101101000101101', '110110011010101101011', '11011011101100001', '0000000011010111001', '11111110100111101111', '10000010000100010001', '10111010000110011', '101110101010111111111', '101110100111100010101', '10000010100101', '11111110111000110101']; | |
| function print_qrcode(qrcode, size, c1, c0) | |
| { | |
| var args = []; | |
| var content = []; | |
| size = size || '22px'; | |
| c1 = c1 || 'black'; | |
| c0 = c0 || 'white'; | |
| for(var i = 0; i < qrcode.length; i++) { | |
| var row = qrcode[i]; | |
| for(var j = 0; j < row.length; j++) { | |
| content.push('%c\u25a0'); | |
| args.push('line-height:0; font-size: ' + size + '; color:' + (row[j] == '1' ? c1 : c0)); | |
| } | |
| content.push('\n'); | |
| } | |
| args.unshift(content.join('')); | |
| console.log.apply(console, args); | |
| } | |
| print_qrcode(qrcode); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment