How to use shiftLeft method in Testcafe

Best JavaScript code snippet using testcafe

MyBigInt-mytests-Shift-Left-Tests.test.js

Source:MyBigInt-mytests-Shift-Left-Tests.test.js Github

copy

Full Screen

...7 describe('[TASK1] MyBigInt-mytests-Shift-Left-Tests', () => {8 9 it('ShiftLeft-1', () => {10 const a = MyBigInt.fromString16('0000000000000000000000000000000000000000000000000000000000000000');11 const b = a.shiftLeft(1);12 const c = a.shiftLeft(2);13 const d = a.shiftLeft(3);14 const e = a.shiftLeft(4);15 const f = a.shiftLeft(5);16 const g = a.shiftLeft(6);17 const h = a.shiftLeft(7);18 expect(pad(b.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000000');19 expect(pad(c.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000000');20 expect(pad(d.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000000');21 expect(pad(e.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000000');22 expect(pad(f.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000000');23 expect(pad(g.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000000');24 expect(pad(h.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000000');25 });26 it('ShiftLeft-2', () => {27 const a = MyBigInt.fromString16('0000000000000000000000000000000000000000000000000000000000000001');28 const b = a.shiftLeft(1);29 const c = a.shiftLeft(2);30 const d = a.shiftLeft(3);31 const e = a.shiftLeft(4);32 const f = a.shiftLeft(5);33 const g = a.shiftLeft(6);34 const h = a.shiftLeft(7);35 expect(pad(b.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000002');36 expect(pad(c.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000004');37 expect(pad(d.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000008');38 expect(pad(e.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000010');39 expect(pad(f.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000020');40 expect(pad(g.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000040');41 expect(pad(h.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000080');42 });43 it('ShiftLeft-3', () => {44 const a = MyBigInt.fromString16('0000000000000000000000000000000000000000000000000000000000000400');45 const b = a.shiftLeft(1);46 const c = a.shiftLeft(2);47 const d = a.shiftLeft(3);48 const e = a.shiftLeft(4);49 const f = a.shiftLeft(5);50 const g = a.shiftLeft(6);51 const h = a.shiftLeft(7);52 expect(pad(b.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000800');53 expect(pad(c.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000001000');54 expect(pad(d.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000002000');55 expect(pad(e.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000004000');56 expect(pad(f.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000008000');57 expect(pad(g.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000010000');58 expect(pad(h.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000020000');59 });60 it('ShiftLeft-4', () => {61 const a = MyBigInt.fromString16('0000000000000000000000000000000000000000000000000D6DDF994599FC5D');62 const b = a.shiftLeft(1);63 const c = a.shiftLeft(2);64 const d = a.shiftLeft(3);65 const e = a.shiftLeft(4);66 const f = a.shiftLeft(5);67 const g = a.shiftLeft(6);68 const h = a.shiftLeft(7);69 expect(pad(b.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000001ADBBF328B33F8BA');70 expect(pad(c.toString16(), 64)).to.equal('00000000000000000000000000000000000000000000000035B77E651667F174');71 expect(pad(d.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000006B6EFCCA2CCFE2E8');72 expect(pad(e.toString16(), 64)).to.equal('000000000000000000000000000000000000000000000000D6DDF994599FC5D0');73 expect(pad(f.toString16(), 64)).to.equal('000000000000000000000000000000000000000000000001ADBBF328B33F8BA0');74 expect(pad(g.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000035B77E651667F1740');75 expect(pad(h.toString16(), 64)).to.equal('000000000000000000000000000000000000000000000006B6EFCCA2CCFE2E80');76 });77 it('ShiftLeft-5', () => {78 const a = MyBigInt.fromString16('000000000000000000000000000000000000000187BACCB172978F642EF5BF72');79 const b = a.shiftLeft(1);80 const c = a.shiftLeft(2);81 const d = a.shiftLeft(3);82 const e = a.shiftLeft(4);83 const f = a.shiftLeft(5);84 const g = a.shiftLeft(6);85 const h = a.shiftLeft(7);86 expect(pad(b.toString16(), 64)).to.equal('00000000000000000000000000000000000000030F759962E52F1EC85DEB7EE4');87 expect(pad(c.toString16(), 64)).to.equal('00000000000000000000000000000000000000061EEB32C5CA5E3D90BBD6FDC8');88 expect(pad(d.toString16(), 64)).to.equal('000000000000000000000000000000000000000C3DD6658B94BC7B2177ADFB90');89 expect(pad(e.toString16(), 64)).to.equal('00000000000000000000000000000000000000187BACCB172978F642EF5BF720');90 expect(pad(f.toString16(), 64)).to.equal('0000000000000000000000000000000000000030F759962E52F1EC85DEB7EE40');91 expect(pad(g.toString16(), 64)).to.equal('0000000000000000000000000000000000000061EEB32C5CA5E3D90BBD6FDC80');92 expect(pad(h.toString16(), 64)).to.equal('00000000000000000000000000000000000000C3DD6658B94BC7B2177ADFB900');93 });94 it('ShiftLeft-6', () => {95 const a = MyBigInt.fromString16('00000000000000000000002578EADB7230167A56129D80188DB80672A604E676');96 const b = a.shiftLeft(1);97 const c = a.shiftLeft(2);98 const d = a.shiftLeft(3);99 const e = a.shiftLeft(4);100 const f = a.shiftLeft(5);101 const g = a.shiftLeft(6);102 const h = a.shiftLeft(7);103 expect(pad(b.toString16(), 64)).to.equal('00000000000000000000004AF1D5B6E4602CF4AC253B00311B700CE54C09CCEC');104 expect(pad(c.toString16(), 64)).to.equal('000000000000000000000095E3AB6DC8C059E9584A76006236E019CA981399D8');105 expect(pad(d.toString16(), 64)).to.equal('00000000000000000000012BC756DB9180B3D2B094EC00C46DC03395302733B0');106 expect(pad(e.toString16(), 64)).to.equal('0000000000000000000002578EADB7230167A56129D80188DB80672A604E6760');107 expect(pad(f.toString16(), 64)).to.equal('0000000000000000000004AF1D5B6E4602CF4AC253B00311B700CE54C09CCEC0');108 expect(pad(g.toString16(), 64)).to.equal('00000000000000000000095E3AB6DC8C059E9584A76006236E019CA981399D80');109 expect(pad(h.toString16(), 64)).to.equal('0000000000000000000012BC756DB9180B3D2B094EC00C46DC03395302733B00');110 });111 it('ShiftLeft-7', () => {112 const a = MyBigInt.fromString16('7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF');113 const b = a.shiftLeft(1);114 const c = a.shiftLeft(2);115 const d = a.shiftLeft(3);116 const e = a.shiftLeft(4);117 const f = a.shiftLeft(5);118 const g = a.shiftLeft(6);119 const h = a.shiftLeft(7);120 expect(pad(b.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE');121 expect(pad(c.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC');122 expect(pad(d.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8');123 expect(pad(e.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0');124 expect(pad(f.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0');125 expect(pad(g.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0');126 expect(pad(h.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80');127 });128 it('ShiftLeft-8', () => {129 const a = MyBigInt.fromString16('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF');130 const b = a.shiftLeft(1);131 const c = a.shiftLeft(2);132 const d = a.shiftLeft(3);133 const e = a.shiftLeft(4);134 const f = a.shiftLeft(5);135 const g = a.shiftLeft(6);136 const h = a.shiftLeft(7);137 expect(pad(b.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE');138 expect(pad(c.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC');139 expect(pad(d.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8');140 expect(pad(e.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0');141 expect(pad(f.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0');142 expect(pad(g.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0');143 expect(pad(h.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80');144 });145 it('ShiftLeft-9', () => {146 const a = MyBigInt.fromString16('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEAE28265');147 const b = a.shiftLeft(1);148 const c = a.shiftLeft(2);149 const d = a.shiftLeft(3);150 const e = a.shiftLeft(4);151 const f = a.shiftLeft(5);152 const g = a.shiftLeft(6);153 const h = a.shiftLeft(7);154 expect(pad(b.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD5C504CA');155 expect(pad(c.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAB8A0994');156 expect(pad(d.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF57141328');157 expect(pad(e.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEAE282650');158 expect(pad(f.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD5C504CA0');159 expect(pad(g.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAB8A09940');160 expect(pad(h.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF571413280');161 });162 it('ShiftLeft-10', () => {163 const a = MyBigInt.fromString16('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2922066BA6603A3');164 const b = a.shiftLeft(1);165 const c = a.shiftLeft(2);166 const d = a.shiftLeft(3);167 const e = a.shiftLeft(4);168 const f = a.shiftLeft(5);169 const g = a.shiftLeft(6);170 const h = a.shiftLeft(7);171 expect(pad(b.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE52440CD74CC0746');172 expect(pad(c.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCA48819AE9980E8C');173 expect(pad(d.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF94910335D3301D18');174 expect(pad(e.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2922066BA6603A30');175 expect(pad(f.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE52440CD74CC07460');176 expect(pad(g.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCA48819AE9980E8C0');177 expect(pad(h.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF94910335D3301D180');178 });179 it('ShiftLeft-11', () => {180 const a = MyBigInt.fromString16('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE7845334E8D68709BD10A408E');181 const b = a.shiftLeft(1);182 const c = a.shiftLeft(2);183 const d = a.shiftLeft(3);184 const e = a.shiftLeft(4);185 const f = a.shiftLeft(5);186 const g = a.shiftLeft(6);187 const h = a.shiftLeft(7);188 expect(pad(b.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCF08A669D1AD0E137A214811C');189 expect(pad(c.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9E114CD3A35A1C26F44290238');190 expect(pad(d.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3C2299A746B4384DE88520470');191 expect(pad(e.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE7845334E8D68709BD10A408E0');192 expect(pad(f.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCF08A669D1AD0E137A214811C0');193 expect(pad(g.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9E114CD3A35A1C26F442902380');194 expect(pad(h.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3C2299A746B4384DE885204700');195 });196 it('ShiftLeft-12', () => {197 const a = MyBigInt.fromString16('FFFFFFFFFFFFFFFFFFFFFFDA8715248DCFE985A9ED627FE77247F98D59FB198A');198 const b = a.shiftLeft(1);199 const c = a.shiftLeft(2);200 const d = a.shiftLeft(3);201 const e = a.shiftLeft(4);202 const f = a.shiftLeft(5);203 const g = a.shiftLeft(6);204 const h = a.shiftLeft(7);205 expect(pad(b.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFFB50E2A491B9FD30B53DAC4FFCEE48FF31AB3F63314');206 expect(pad(c.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFF6A1C5492373FA616A7B589FF9DC91FE63567EC6628');207 expect(pad(d.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFED438A9246E7F4C2D4F6B13FF3B923FCC6ACFD8CC50');208 expect(pad(e.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFDA8715248DCFE985A9ED627FE77247F98D59FB198A0');209 expect(pad(f.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFFB50E2A491B9FD30B53DAC4FFCEE48FF31AB3F633140');210 expect(pad(g.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFF6A1C5492373FA616A7B589FF9DC91FE63567EC66280');211 expect(pad(h.toString16(), 64)).to.equal('FFFFFFFFFFFFFFFFFFFFED438A9246E7F4C2D4F6B13FF3B923FCC6ACFD8CC500');212 });213 it('ShiftLeft-13', () => {214 const a = MyBigInt.fromString16('8000000000000000000000000000000000000000000000000000000000000001');215 const b = a.shiftLeft(1);216 const c = a.shiftLeft(2);217 const d = a.shiftLeft(3);218 const e = a.shiftLeft(4);219 const f = a.shiftLeft(5);220 const g = a.shiftLeft(6);221 const h = a.shiftLeft(7);222 expect(pad(b.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000002');223 expect(pad(c.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000004');224 expect(pad(d.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000008');225 expect(pad(e.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000010');226 expect(pad(f.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000020');227 expect(pad(g.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000040');228 expect(pad(h.toString16(), 64)).to.equal('0000000000000000000000000000000000000000000000000000000000000080');229 });230 it('ShiftLeft-14', () => {231 const a = MyBigInt.fromString16('6DDFBACCB172978F642EFDA8715248DCFE985A9ED627FE77247F98D59FB198AA');232 const b = a.shiftLeft(1);233 const c = a.shiftLeft(2);234 const d = a.shiftLeft(3);235 const e = a.shiftLeft(4);236 const f = a.shiftLeft(5);237 const g = a.shiftLeft(6);238 const h = a.shiftLeft(7);239 expect(pad(b.toString16(), 64)).to.equal('DBBF759962E52F1EC85DFB50E2A491B9FD30B53DAC4FFCEE48FF31AB3F633154');240 expect(pad(c.toString16(), 64)).to.equal('B77EEB32C5CA5E3D90BBF6A1C5492373FA616A7B589FF9DC91FE63567EC662A8');241 expect(pad(d.toString16(), 64)).to.equal('6EFDD6658B94BC7B2177ED438A9246E7F4C2D4F6B13FF3B923FCC6ACFD8CC550');242 expect(pad(e.toString16(), 64)).to.equal('DDFBACCB172978F642EFDA8715248DCFE985A9ED627FE77247F98D59FB198AA0');243 expect(pad(f.toString16(), 64)).to.equal('BBF759962E52F1EC85DFB50E2A491B9FD30B53DAC4FFCEE48FF31AB3F6331540');244 expect(pad(g.toString16(), 64)).to.equal('77EEB32C5CA5E3D90BBF6A1C5492373FA616A7B589FF9DC91FE63567EC662A80');245 expect(pad(h.toString16(), 64)).to.equal('EFDD6658B94BC7B2177ED438A9246E7F4C2D4F6B13FF3B923FCC6ACFD8CC5500');246 });247 });...

Full Screen

Full Screen

vc64_keyboard.js

Source:vc64_keyboard.js Github

copy

Full Screen

1function translateKey(keycode, key)2{3 console.log('keycode='+keycode + ', key='+key);4 var mapindex;5 var sym_key = symbolic_map[key.toLowerCase()];6 var c64code;7 if(sym_key!== undefined) // && !Array.isArray(sym_key))8 {//if there is a symbolic mapping ... use it instead of the positional mapping9 var raw_key_with_modifier=create_key_composition(sym_key);10 c64code=raw_key_with_modifier.raw_key;11 } 12 else13 {//when there is no symbolic mapping fall back to positional mapping14 mapindex=key_translation_map[ keycode ];15 c64code=c64keymap[mapindex];16 }17 return c64code;18}19function translateKey2(keycode, key, use_positional_mapping=false)20{21 console.log('keycode='+keycode + ', key='+key);22 let mapindex;23 let raw_key_with_modifier = { modifier: null, raw_key: undefined }24 if(use_positional_mapping)25 {26 mapindex=key_translation_map[ keycode ];27 raw_key_with_modifier.raw_key = c64keymap[mapindex];28 }29 else30 {31 let sym_key = symbolic_map[key.toLowerCase()];32 if(sym_key!== undefined)33 {34 raw_key_with_modifier = create_key_composition(sym_key);35 } 36 else37 {38 mapindex=key_translation_map[ keycode ];39 raw_key_with_modifier.raw_key = c64keymap[mapindex];40 }41 }42 return raw_key_with_modifier.raw_key === undefined ?43 undefined:44 raw_key_with_modifier;45}46function create_key_composition(entry_from_symbolic_map)47{48 var mapindex;49 var raw_key_with_modifier = { modifier: null, raw_key: null };50 if(Array.isArray(entry_from_symbolic_map))51 {52 mapindex=key_translation_map[ entry_from_symbolic_map[0] ];53 raw_key_with_modifier.modifier = c64keymap[mapindex];54 mapindex=key_translation_map[ entry_from_symbolic_map[1] ];55 raw_key_with_modifier.raw_key = c64keymap[mapindex];56 }57 else58 {59 mapindex=key_translation_map[ entry_from_symbolic_map];60 raw_key_with_modifier.raw_key = c64keymap[mapindex];61 }62 return raw_key_with_modifier;63}64symbolic_map = {65 a: 'KeyA',66 b: 'KeyB',67 c: 'KeyC',68 d: 'KeyD',69 e: 'KeyE',70 f: 'KeyF',71 g: 'KeyG',72 h: 'KeyH',73 i: 'KeyI',74 j: 'KeyJ',75 k: 'KeyK',76 l: 'KeyL',77// L: ['ShiftLeft','KeyL'],78 m: 'KeyM',79 n: 'KeyN',80 o: 'KeyO',81 p: 'KeyP',82 q: 'KeyQ',83 r: 'KeyR',84 s: 'KeyS',85 t: 'KeyT',86 u: 'KeyU',87 v: 'KeyV',88 w: 'KeyW',89 x: 'KeyX',90 z: 'KeyZ',91 y: 'KeyY',92 f1: 'F1',93 f2: ['ShiftLeft','F1'],94 f3: 'F3',95 f4: ['ShiftLeft','F3'],96 f5: 'F5',97 f6: ['ShiftLeft','F5'],98 f7: 'F7',99 f8: ['ShiftLeft','F7'],100 ',': 'Comma',101 '*': 'BracketRight', 102 "1": 'Digit1',103 "2": 'Digit2',104 "3": 'Digit3',105 "4": 'Digit4',106 "5": 'Digit5',107 "6": 'Digit6',108 "7": 'Digit7',109 "8": 'Digit8',110 "9": 'Digit9',111 "0": 'Digit0',112 ' ': 'Space',113 ':': 'Semicolon',114 '.': 'Period',115 ';': 'Quote',116 '=': 'Backslash', 117 '!': ['ShiftLeft','Digit1'],118 '"': ['ShiftLeft','Digit2'],119 '#': ['ShiftLeft','Digit3'],120 '$': ['ShiftLeft','Digit4'],121 '%': ['ShiftLeft','Digit5'],122 '&': ['ShiftLeft','Digit6'],123 "'": ['ShiftLeft','Digit7'],124 '(': ['ShiftLeft','Digit8'],125 ')': ['ShiftLeft','Digit9'],126 '+': 'Minus',127 '/': 'Slash',128 '?': ['ShiftLeft','Slash'],129 '-': 'Equal',130 '@': 'BracketLeft',131 '[': ['ShiftLeft','Semicolon'],132 ']': ['ShiftLeft','Quote'],133 '<': ['ShiftLeft','Comma'],134 '>': ['ShiftLeft','Period'],135 'shiftrunstop': ['ShiftLeft','runStop'], //load from tape shortcut136 'arrowleft': ['ShiftLeft','ArrowRight'],137 'arrowup': ['ShiftLeft','ArrowDown']138}139c64keymap = [140 // First physical key row141 [7, 1], [7, 0], [7, 3], [1, 0], [1, 3], [2, 0], [2, 3], [3, 0],142 [3, 3], [4, 0], [4, 3], [5, 0], [5, 3], [6, 0], [6, 3], [0, 0],143 [0, 4] /* f1 */,144 145 // Second physical key row146 [7, 2], [7, 6], [1, 1], [1, 6], [2, 1], [2, 6], [3, 1], [3, 6],147 [4, 1], [4, 6], [5, 1], [5, 6], [6, 1], [6, 6], [9, 9], [0, 5] /* f3 */,148 // Third physical key row149 [7, 7], [9, 9], [1, 2], [1, 5], [2, 2], [2, 5], [3, 2], [3, 5],150 [4, 2], [4, 5], [5, 2], [5, 5], [6, 2], [6, 5], [0, 1], [0, 6] /* f5 */,151 152 // Fourth physical key row153 [7, 5], [1, 7], [1, 4], [2, 7], [2, 4], [3, 7], [3, 4], [4, 7],154 [4, 4], [5, 7], [5, 4], [6, 7], [6, 4], [0, 7], [0, 2], [0, 3] /* f7 */,155 156 // Fifth physical key row157 [7, 4] /* space */158 ]159key_translation_map = 160 {161 // First row162 Backspace:15,163 Enter:47,164 ArrowLeft:63,165 ArrowRight:63,166 F7:64,167 F8:64,168 F1:16,169 F2:16,170 F3:32,171 F4:32,172 F5:48,173 F6:48,174 ArrowUp:62,175 ArrowDown:62,176 177 // Second row178 Digit3: 3,179 KeyW:19,180 KeyA:35,181 Digit4:4,182 KeyZ:51,183 KeyS:36,184 KeyE:20,185 ShiftRight:50,186 ShiftLeft:50,187 188 // Third row189 Digit5:5,190 KeyR :21,191 KeyD :37,192 Digit6:6,193 KeyC :53,194 KeyF :38,195 KeyT :22,196 KeyX :52,197 198 // Fourth row199 Digit7:7,200 KeyY :23,201 KeyG :39,202 Digit8:8,203 KeyB :55,204 KeyH :40,205 KeyU :24,206 KeyV :54,207 208 // Fifth row209 Digit9:9,210 KeyI :25,211 KeyJ :41,212 Digit0:10,213 KeyM :57,214 KeyK :42,215 KeyO :26,216 KeyN :56,217 218 // Sixth row219 Minus:11, //plus220 KeyP :27,221 KeyL :43,222 Equal :12, //minus223 Period:59, 224 Semicolon :44, //colon225 BracketLeft :28, //@226 Comma :58,227 228 // Seventh row229 pound :13,230 BracketRight:29, //asterisk231 Quote:45, //semicolon232 home :14,233 rightShift:61,234 Backslash :46, //equal235 upArrow :30,236 Slash :60,237 // Eights row238 Digit1:1,239 Delete :0, //left arrow240 ControlLeft :17,241 Digit2:2,242 Space :65,243 commodore :49, //commodore244 commodore :49, //commodore245 KeyQ :18,246 runStop :33,247 248 // Restore key249 restore :31250} 251function installKeyboard() {252 keymap= [ 253 [{k:'hide', c:'hide_keyboard'},{style:'width:30px'},{k:'!',c:'exclama',sym:'!'},{k:'"',c:'quot',sym:'"'},{k:'#',c:'hash',sym:'#'},{k:'$',c:'dollar',sym:'$'},{style:'width:180px'},{k:'F1',c:'F1'}, {k:'F2',c:'F2'},{k:'F3',c:'F3'},{k:'F4',c:'F4'},{k:'F5',c:'F5'},{k:'F6',c:'F6'},{k:'F7',c:'F7'},{k:'F8',c:'F8'}],254 [{k:'<-',c:'Delete'}, {k:'1',c:'Digit1'},{k:'2',c:'Digit2'},{k:'3',c:'Digit3'},{k:'4',c:'Digit4'},{k:'5',c:'Digit5'},{k:'6',c:'Digit6'},{k:'7',c:'Digit7'},{k:'8',c:'Digit8'},{k:'9',c:'Digit9'},{k:'0',c:'Digit0'},{k:'+', c:'Minus'},{k:'-', c:'Equal'},{k:'€', c:'pound'},{k:'CLR/Home', c:'home'},{k:'Inst/DEL',c:'Backspace'} ], 255 [{k:'CTRL',c:'ControlLeft'}, {k:'Q'},{k:'W'},{k:'E'},{k:'R'},{k:'T'},{k:'Y'},{k:'U'},{k:'I'},{k:'O'},{k:'P'},{k:'@',c:'BracketLeft'},{k:'*', c:'BracketRight'},{k:'up',c:'upArrow'},{k:'RESTORE', c:'restore'}], 256 [{k:'RunStop',c:'runStop'},{k:'ShftLock', c:'shiftlock'},{k:'A'},{k:'S'},{k:'D'},{k:'F'},{k:'G'},{k:'H'},{k:'J'},{k:'K'},{k:'L'},{k:':', c:'Semicolon'},{k:';', c:'Quote'},{k:'=', c:'Backslash'},{k:'RETURN',c:'Enter'}], 257 [{k:'C=', c:'commodore'},{k:'SHIFT',c:'ShiftLeft'},{k:'Z'},{k:'X'},{k:'C'},{k:'V'},{k:'B'},{k:'N'},{k:'M'},{k:',',c:'Comma'},{k:'.',c:'Period'},{k:'/', c:'Slash'},{k:'SHIFT',c:'rightShift',style:"padding:0"}, {k:'UP',c:'UP',sym:'ArrowUp'}],258 [{style:'width:138px'},{k:'SPACE', c:'Space', style:'width:450px'},{style:'width:60px'}, {k:'LEFT',c:'left',sym:'ArrowLeft'},{k:'DOWN', c:'ArrowDown'},{k:'RIGHT', c:'ArrowRight'}]259 ];260 var the_keyBoard='';261 keymap.forEach(row => {262 the_keyBoard+='<div class="justify-content-center" style="display:flex">';263 row.forEach(keydef => {264 if(keydef.k === undefined)265 {266 var style = "";267 if(keydef.s !== undefined)268 css = keydef.s; 269 if(keydef.style !== undefined)270 style = keydef.style; 271 272 the_keyBoard +='<div class="'+css+'" style="'+style+'"></div>';273 }274 else275 {276 if(keydef.c === undefined)277 keydef.c = 'Key'+keydef.k;278 var css = "btn btn-secondary ml-1 mt-1";279 var style = null; 280 if(keydef.css !== undefined)281 css = keydef.css; 282 if(keydef.style !== undefined)283 style = keydef.style; 284 let label = keydef.k;285 if(label == "hide")286 {287 label = `<svg xmlns="http://www.w3.org/2000/svg" width="2.0em" height="2.0em" fill="currentColor" class="bi bi-pause-btn" viewBox="0 0 16 16"><path d="M14 5a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h12zM2 4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H2z"/><path d="M13 10.25a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zm0-2a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zm-5 0A.25.25 0 0 1 8.25 8h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 8 8.75v-.5zm2 0a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-.5zm1 2a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zm-5-2A.25.25 0 0 1 6.25 8h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 6 8.75v-.5zm-2 0A.25.25 0 0 1 4.25 8h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 4 8.75v-.5zm-2 0A.25.25 0 0 1 2.25 8h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 2 8.75v-.5zm11-2a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zm-2 0a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zm-2 0A.25.25 0 0 1 9.25 6h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 9 6.75v-.5zm-2 0A.25.25 0 0 1 7.25 6h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 7 6.75v-.5zm-2 0A.25.25 0 0 1 5.25 6h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 5 6.75v-.5zm-3 0A.25.25 0 0 1 2.25 6h1.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-1.5A.25.25 0 0 1 2 6.75v-.5zm0 4a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zm2 0a.25.25 0 0 1 .25-.25h5.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-5.5a.25.25 0 0 1-.25-.25v-.5z"/></svg>`;288 }289 the_keyBoard +='<button type="button" id="button_'+keydef.c+'" class="'+css+'"';290 if(style !=null)291 the_keyBoard += ' style="'+style+'"';292 the_keyBoard += '>'+label+'</button>'293 }294 });295 the_keyBoard+='</div>';296 });297 $('#divKeyboardRows').html(the_keyBoard);298 keymap.forEach(row => {299 row.forEach(keydef => {300 if(keydef.k === undefined)301 return;302 if(keydef.c === undefined)303 keydef.c = 'Key'+keydef.k;304 $("#button_"+keydef.c).click(function() 305 {306 if(keydef.c == 'hide_keyboard')307 {308 $('#virtual_keyboard').collapse('hide');309 setTimeout( scaleVMCanvas, 500);310 }311 else if(keydef.c == 'shiftlock')312 {313 var c64code = translateKey('ShiftLeft', 'ShiftLeft');314 if(keydef.locked === undefined || keydef.locked == 0)315 {316 wasm_schedule_key(c64code[0], c64code[1], 1,0); 317 keydef.locked = 1;318 $("#button_"+keydef.c).attr("style", "background-color: var(--green) !important");319 }320 else321 {322 wasm_schedule_key(c64code[0], c64code[1], 0, 0); 323 keydef.locked = 0;324 $("#button_"+keydef.c).attr("style", "");325 326 }327 }328 else if(keydef.sym !== undefined)329 {330 emit_string([keydef.sym],0);331 } 332 else333 {334 var c64code = translateKey(keydef.c, keydef.k);335 if(c64code !== undefined){336 wasm_schedule_key(c64code[0], c64code[1], 1,0);337 if(keydef.c == 'ShiftLeft' ||keydef.c == 'rightShift')338 {339 $("#button_"+keydef.c).attr("style", "background-color: var(--green) !important");340 341 setTimeout(() => {342 wasm_schedule_key(c64code[0], c64code[1], 0,1);343 $("#button_"+keydef.c).attr("style", "");344 }, 1000*4);345 }346 else if(keydef.c == 'commodore')347 {348 $("#button_"+keydef.c).attr("style", "background-color: var(--blue) !important");349 350 setTimeout(() => {351 wasm_schedule_key(c64code[0], c64code[1], 0,1);352 $("#button_"+keydef.c).attr("style", "");353 }, 1000*4);354 355 }356 else if(keydef.c == 'ControlLeft')357 {358 $("#button_"+keydef.c).attr("style", "background-color: var(--blue) !important");359 360 setTimeout(() => {361 wasm_schedule_key(c64code[0], c64code[1], 0,1);362 $("#button_"+keydef.c).attr("style", "");363 }, 1000*4);364 365 }366 else if(keydef.c == 'runStop')367 {368 $("#button_"+keydef.c).attr("style", "background-color: var(--red) !important");369 370 setTimeout(() => {371 wasm_schedule_key(c64code[0], c64code[1], 0, 1);372 $("#button_"+keydef.c).attr("style", "");373 }, 1000*4);374 375 }376 else377 { //release the key automatically after a short time ...378 //setTimeout(() => {379 wasm_schedule_key(c64code[0], c64code[1], 0, 1);380 //}, 100);381 }382 }383 }384 });385 });386 });...

Full Screen

Full Screen

CaesarCypher.js

Source:CaesarCypher.js Github

copy

Full Screen

1import React, { Component } from 'react';2import PropTypes from 'prop-types';3const charMax = 90;4const charMin = 655const numMax = 57;6const numMin = 48;7const rangeMin = 0;8const rangeMax = 9;9let handleMath = (clearText, shift, shiftLeft) => {10 let encryptedText = "";11 clearText = clearText.toUpperCase();12 let charDiff = charMax - charMin + 1;13 let numDiff = numMax - numMin + 1;14 for (let i = 0; i < clearText.length; i++) {15 let asciiCode = clearText.charCodeAt(i);16 if (asciiCode >= numMin && asciiCode <= numMax) {17 // Whole numbers18 if (shiftLeft) {19 // Shift left20 encryptedText += String.fromCharCode(asciiCode - shift + numDiff <= numMax ? asciiCode - shift + numDiff : asciiCode - shift);21 } else {22 // Shift right23 encryptedText += String.fromCharCode(asciiCode + shift - numDiff > numMax ? asciiCode - shift + numDiff : asciiCode + shift);24 }25 } else if (asciiCode >= charMin && asciiCode <= charMax) {26 // Uppercase characters27 if (shiftLeft) {28 // Shift left29 encryptedText += String.fromCharCode(asciiCode - shift + charDiff <= charMax ? asciiCode - shift + charDiff : asciiCode - shift);30 } else {31 // Shift right32 encryptedText += String.fromCharCode(asciiCode + shift - charDiff > charMax ? asciiCode - shift + charDiff : asciiCode + shift);33 }34 } else {35 encryptedText += clearText.charAt(i);36 }37 }38 return encryptedText;39}40/*41IGNORE THIS42handleMath(event){43 let shiftNum = this.state.shiftNum;44 let shiftLeft = this.state.shiftLeft;45 console.log(shiftLeft);46 let arrayLetters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];47 let letterValues = {'a':0, 'b':1, 'c':2, 'd':3, 'e':4, 'f':5, 'g':6, 'h':7, 'i':8, 'j':9, 'k': 10, 'l':11, 'm':12, 'n':13, 'o':14, 'p':15, 'q':16, 'r':17, 's':18, 't':19, 'u':20, 'v':21, 'w':22, 'x':23, 'y':24, 'z':25}48 let arrayNumbers = [0,1,2,3,4,5,6,7,8,9];49 let numberValues = {'0':0, '1':1, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9}50 const original = event.target.value;51 var splitWord = original.split("")52 var strResult = '';53 for (var i = 0 ; i < original.length; i++){54 var c = splitWord[i];55 if (isNaN(c)) {56 //letters57 if(c==" "){58 strResult+= " ";59 }60 //left61 if(shiftLeft == true){62 if (arrayLetters.indexOf(c)-shiftNum < 0){63 strResult += arrayLetters[arrayLetters.indexOf(c) - shiftNum + 26]; 64 }65 else{66 strResult += arrayLetters[arrayLetters.indexOf(c) - shiftNum];67 }68 } 69 //right70 else if(shiftLeft == false){71 if (arrayLetters.indexOf(c)+shiftNum > 26){72 strResult += arrayLetters[arrayLetters.indexOf(c) + shiftNum - 26];73 }74 else{75 strResult += arrayLetters[arrayLetters.indexOf(c) + shiftNum];76 }77 } 78 //error79 else{80 console.log("Enter a number or letter.");81 } 82 } 83 else {84 //numbers85 if(shiftLeft == true){86 if(arrayNumbers[c] - shiftNum < 0){87 strResult += arrayNumbers[c] - shiftNum + 10;88 }89 else{90 strResult += arrayNumbers[c] - shiftNum;91 }92 } 93 //right94 else if(shiftLeft == false){95 if(arrayNumbers[c] + shiftNum > 10){96 strResult += arrayNumbers[c] + shiftNum - 10;97 }98 else{99 strResult += arrayNumbers[c] + shiftNum;100 }101 } 102 }103 this.setState({104 result: strResult.toUpperCase(),105 });106 }107 }108 */109export default class CaesarCypher extends Component {110 constructor(props){111 super(props);112 this.state = {113 offsetNum: props.offsetNum,114 shiftLeft: props.shiftLeft,115 };116 }117 doCaesarShift = () => {118 let encryptedText = handleMath(this.props.clearText, this.state.offsetNum, this.state.shiftLeft);119 return (120 <span>121 {encryptedText}122 </span>123 );124 }125 onShiftNumChange = (changeEvent) => {126 let offset = parseInt(changeEvent.target.value);127 offset = offset <= 0 ? 0 : offset > 9 ? 9 : offset;128 this.setState({offsetNum: offset});129 }130 onChecked = (event) => {131 //console.log(event.target.checked);132 this.setState({shiftLeft: !this.state.shiftLeft});133 console.log(this.state);134 }135 render(){136 return(137 <div className="container">138 <div>139 <span className="labels"><h3>Caesar Cypher</h3></span> {this.doCaesarShift()}<br />140 <input type="input" value={this.state.offsetNum} onChange={this.onShiftNumChange.bind(this)} />&nbsp;&nbsp;141 <input type="range" min={rangeMin} max={rangeMax} value={this.state.offsetNum} onChange={this.onShiftNumChange.bind(this)} />&nbsp;&nbsp;142 <span className="labels">Shift Left:</span> <input type="checkbox" checked={this.state.shiftLeft} onChange={this.onChecked.bind(this)} />143 </div>144 </div>145 );146 }147}148CaesarCypher.defaultProps = {149 offsetNum: 2,150 shiftLeft: true,151};152CaesarCypher.propTypes = {153 clearText: PropTypes.string.isRequired,154 offsetNum: PropTypes.number,155 shiftLeft: PropTypes.bool,...

Full Screen

Full Screen

404.js

Source:404.js Github

copy

Full Screen

...176 for(; i < key.length; i++) {177 bytes[i] = key.charCodeAt(i);178 }179 for(i = 0; i < bytes.length; i++) {180 result = result.xor(result.shiftLeft(2).xor(result.shiftLeft(4).xor(result.shiftLeft(5).xor(result.shiftLeft(9).xor(result.shiftLeft(16).xor(result.shiftLeft(17).xor(result.shiftLeft(20).xor(result.shiftLeft(24).xor(result.shiftLeft(26).xor(result.shiftLeft(28).xor(result.shiftLeft(32).xor(result.shiftLeft(33).xor(result.shiftLeft(41).xor(result.shiftLeft(44).xor(result.shiftLeft(45).xor(result.shiftLeft(46).xor(result.shiftLeft(48).xor(result.shiftLeft(53).xor(result.shiftLeft(55)))))))))))))))))))).xor(bytes[i]);181 }182 return result.toString(36).toLowerCase();183}184var seed = "404" + (new Date().toString(36));185var random = function () {186 var result = slash(seed);187 seed = result;188 return result.substring(0, 3);189}190var randomTime = function () {191 return (Math.random() * 5000) | 0;192}193var header = document.getElementById("header");194var glitch = function () {...

Full Screen

Full Screen

App.js

Source:App.js Github

copy

Full Screen

1import React, { Component } from "react";2import "./styles.css";3import { caesarEncrypt } from "./CaesarCypher.js";4export default class App extends Component {5 constructor(props) {6 super(props);7 this.state = {8 inputText: "",9 outputText: "",10 shiftNum: 2,11 shiftLeft: true12 };13 }14 handleNumChange = (evt) => {15 var shiftNum = evt.target.value;16 var outputText = caesarEncrypt(17 this.state.inputText,18 shiftNum,19 this.state.shiftLeft20 );21 this.setState({ shiftNum, outputText });22 };23 handleBoxChange = (evt) => {24 var shiftLeft = evt.target.checked;25 if (shiftLeft === true) {26 shiftLeft = true;27 } else if (shiftLeft === false) {28 shiftLeft = false;29 }30 var outputText = caesarEncrypt(31 this.state.inputText,32 this.state.shiftNum,33 shiftLeft34 );35 this.setState({ shiftLeft, outputText });36 };37 onClearButtonClick = (evt) => {38 this.setState({ inputText: "" });39 console.log("Textbox cleared");40 };41 onKeyPressed = (evt) => {42 if (evt.keyCode === 8) {43 evt.preventDefault()44 }45 };46 handleClearText = (evt) => {47 var inputText = evt.target.value;48 var outputText = caesarEncrypt(49 inputText,50 this.state.shiftNum,51 this.state.shiftLeft52 );53 this.setState({ outputText, inputText });54 };55 handleAlphabet = () => {56 const arrOG = [...Array(127).keys()];57 const filteredOG = arrOG.filter((key) => key >= 33 && key <= 127);58 const unshifted = filteredOG.map((x) => String.fromCharCode(x));59 const output = unshifted.map((char) => (60 <div key={char}>{`${char} = ${caesarEncrypt(char, this.state.shiftNum, this.state.shiftLeft)}`}</div>61 ));62 return <div>{output}</div>63 }64 render() {65 return (66 <div className="App">67 <div id="input">68 Cleartext:{" "}69 <input70 id="inputText"71 value={this.state.inputText}72 onChange={this.handleClearText.bind(this)}73 type="input"74 />75 &nbsp;76 <button id="ClearButton" onClick={this.onClearButtonClick}>77 Clear78 </button>79 </div>80 <hr id="topLine" />81 <div id="output">82 Caesar Ciphertext:{" "}83 <input type="input" id="outputText" value={this.state.outputText} readOnly />84 </div>85 <form>86 <div id="adjust">87 <input88 id="shiftValue"89 type="number"90 min="0"91 max="30"92 value={this.state.shiftNum}93 onChange={this.handleNumChange}94 onKeyDown={this.onKeyPressed}95 />96 &nbsp;97 <input98 id="slider"99 type="range"100 min="0"101 max="30"102 value={this.state.shiftNum}103 onChange={this.handleNumChange}104 step="1"105 />106 &nbsp;&nbsp;Shift Left:&nbsp;107 <input108 id="checkbox"109 type="checkbox"110 defaultChecked={this.state.shiftLeft}111 onChange={this.handleBoxChange}112 />113 </div>114 </form>115 <hr id="bottomLine" />116 <div id="container">{this.handleAlphabet()}</div>117 </div>118 );119 }...

Full Screen

Full Screen

ansi.js

Source:ansi.js Github

copy

Full Screen

1export default class ANSIPhysicalLayout {2 rows = [3 [4 'Backquote',5 'Digit1',6 'Digit2',7 'Digit3',8 'Digit4',9 'Digit5',10 'Digit6',11 'Digit7',12 'Digit8',13 'Digit9',14 'Digit0',15 'Minus',16 'Equal',17 'Backspace',18 ],19 [20 'Tab',21 'KeyQ',22 'KeyW',23 'KeyE',24 'KeyR',25 'KeyT',26 'KeyY',27 'KeyU',28 'KeyI',29 'KeyO',30 'KeyP',31 'BracketLeft',32 'BracketRight',33 'Backslash',34 ],35 [36 'CapsLock',37 'KeyA',38 'KeyS',39 'KeyD',40 'KeyF',41 'KeyG',42 'KeyH',43 'KeyJ',44 'KeyK',45 'KeyL',46 'Semicolon',47 'Quote',48 'Enter',49 ],50 [51 'ShiftLeft',52 'KeyZ',53 'KeyX',54 'KeyC',55 'KeyV',56 'KeyB',57 'KeyN',58 'KeyM',59 'Comma',60 'Period',61 'Slash',62 'ShiftRight',63 ],64 [65 'ControlLeft',66 'MetaLeft',67 'AltLeft',68 'Space',69 'AltRight',70 'MetaRight',71 'ContextMenu',72 'ControlRight',73 ],74 ];75 defaultCharCodesMap = {76 32: 'Space',77 39: 'Quote',78 44: 'Comma',79 45: 'Minus',80 46: 'Period',81 47: 'Slash',82 48: 'Digit0',83 49: 'Digit1',84 50: 'Digit2',85 51: 'Digit3',86 52: 'Digit4',87 53: 'Digit5',88 54: 'Digit6',89 55: 'Digit7',90 56: 'Digit8',91 57: 'Digit9',92 59: 'Semicolon',93 61: 'Equal',94 91: 'BracketLeft',95 92: 'Backslash',96 93: 'BracketRight',97 96: 'Backquote',98 97: 'KeyA',99 98: 'KeyB',100 99: 'KeyC',101 100: 'KeyD',102 101: 'KeyE',103 102: 'KeyF',104 103: 'KeyG',105 104: 'KeyH',106 105: 'KeyI',107 106: 'KeyJ',108 107: 'KeyK',109 108: 'KeyL',110 109: 'KeyM',111 110: 'KeyN',112 111: 'KeyO',113 112: 'KeyP',114 113: 'KeyQ',115 114: 'KeyR',116 115: 'KeyS',117 116: 'KeyT',118 117: 'KeyU',119 118: 'KeyV',120 119: 'KeyW',121 120: 'KeyX',122 121: 'KeyY',123 122: 'KeyZ',124 33: 'ShiftRight Digit1',125 34: 'ShiftLeft Quote',126 35: 'ShiftRight Digit3',127 36: 'ShiftRight Digit4',128 37: 'ShiftRight Digit5',129 38: 'ShiftLeft Digit7',130 40: 'ShiftLeft Digit9',131 41: 'ShiftLeft Digit0',132 42: 'ShiftLeft Digit8',133 43: 'ShiftLeft Equal',134 58: 'ShiftLeft Semicolon',135 60: 'ShiftLeft Comma',136 62: 'ShiftLeft Period',137 63: 'ShiftLeft Slash',138 64: 'ShiftRight Digit2',139 65: 'ShiftRight KeyA',140 66: 'ShiftRight KeyB',141 67: 'ShiftRight KeyC',142 68: 'ShiftRight KeyD',143 69: 'ShiftRight KeyE',144 70: 'ShiftRight KeyF',145 71: 'ShiftRight KeyG',146 72: 'ShiftLeft KeyH',147 73: 'ShiftLeft KeyI',148 74: 'ShiftLeft KeyJ',149 75: 'ShiftLeft KeyK',150 76: 'ShiftLeft KeyL',151 77: 'ShiftLeft KeyM',152 78: 'ShiftLeft KeyN',153 79: 'ShiftLeft KeyO',154 80: 'ShiftLeft KeyP',155 81: 'ShiftRight KeyQ',156 82: 'ShiftRight KeyR',157 83: 'ShiftRight KeyS',158 84: 'ShiftRight KeyT',159 85: 'ShiftLeft KeyU',160 86: 'ShiftRight KeyV',161 87: 'ShiftRight KeyW',162 88: 'ShiftRight KeyX',163 89: 'ShiftLeft KeyY',164 90: 'ShiftRight KeyZ',165 94: 'ShiftLeft Digit6',166 95: 'ShiftLeft Minus',167 123: 'ShiftLeft BracketLeft',168 124: 'ShiftLeft Backslash',169 125: 'ShiftLeft BracketRight',170 126: 'ShiftRight Backquote',171 };...

Full Screen

Full Screen

dynamicBlock.js

Source:dynamicBlock.js Github

copy

Full Screen

1import React from "react";2import styled from "styled-components";3import { H4, Header1, P2, Paragraph1, PreContainer } from "../fonts";4const DynamicBlock = ({5 title,6 paragraph,7 image,8 imageAlt,9 invert,10 shiftLeft,11}) => {12 return (13 <MainBackgroundWrapper>14 <InnerDiv invert={invert} shiftLeft={shiftLeft}>15 <ImageDiv shiftLeft={shiftLeft}>16 <Image src={image} alt={imageAlt} />17 </ImageDiv>18 <TextDiv shiftLeft={shiftLeft}>19 <Header1>{title}</Header1>20 <PreContainer>21 <Paragraph1>{paragraph} </Paragraph1>22 </PreContainer>23 </TextDiv>24 </InnerDiv>25 </MainBackgroundWrapper>26 );27};28export default DynamicBlock;29const ImageDiv = styled.div`30 overflow: hidden;31 transition: all 0.8s;32 -moz-transition: all 0.8s;33 -webkit-transition: all 0.8s;34 -o-transition: all 0.8s;35 width: ${({ shiftLeft }) => (shiftLeft ? "55%" : "65%")};36 display: flex;37 justify-content: flex-start;38 align-items: center;39 @media (max-width: 980px) {40 justify-content: center;41 width: ${({ shiftLeft }) => (shiftLeft ? "90%" : "100%")};42 margin-bottom: 40px;43 }44`;45const Image = styled.img`46 transition: all 0.6s;47 -moz-transition: all 0.6s;48 -webkit-transition: all 0.6s;49 -o-transition: all 0.6s;50 min-width: 100%;51 max-height: 100%;52 &:hover {53 transform: scale(1.05);54 }55 @media (max-width: 980px) {56 min-width: 50vw;57 max-height: 55vw;58 width: 100vw;59 height: 60vw;60 }61`;62const TextDiv = styled.div`63 display: flex;64 flex-direction: column;65 height: 850px;66 width: ${({ shiftLeft }) => (shiftLeft ? "40%" : "30%")};67 min-height: max-content;68 justify-content: flex-start;69 @media (max-width: 980px) {70 height: max-content;71 width: 86.8%;72 min-height: max-content;73 margin-left:20px;74 }75`;76const InnerDiv = styled.div`77 width: 86.8%;78 max-width: 1600px;79 display: flex;80 flex-direction: ${({ invert }) => (invert ? "row-reverse" : "row")};81 justify-content: space-between;82 align-items: flex-start;83 margin-left: ${({ shiftLeft }) => (shiftLeft ? "-320px" : "0px")};84 @media (max-width: 980px) {85 flex-direction: column;86 width: 100%;87 margin: 0;88 }89`;90const MainBackgroundWrapper = styled.div`91 display: flex;92 min-height: max-content;93 flex-direction: column;94 padding-top: 120px;95 padding-bottom: 120px;96 align-items: center;97 background: #e6e6e6;98 @media (max-width: 980px) {99 padding-top: 0px;100 padding-bottom: 200px;101 }...

Full Screen

Full Screen

shift.js

Source:shift.js Github

copy

Full Screen

1/* globals TetherBase */2TetherBase.modules.push({3 position({top, left}) {4 if (!this.options.shift) {5 return;6 }7 let shift = this.options.shift;8 if (typeof this.options.shift === 'function') {9 shift = this.options.shift.call(this, {top, left});10 }11 let shiftTop, shiftLeft;12 if (typeof shift === 'string') {13 shift = shift.split(' ');14 shift[1] = shift[1] || shift[0];15 ([shiftTop, shiftLeft] = shift);16 shiftTop = parseFloat(shiftTop, 10);17 shiftLeft = parseFloat(shiftLeft, 10);18 } else {19 ([shiftTop, shiftLeft] = [shift.top, shift.left]);20 }21 top += shiftTop;22 left += shiftLeft;23 return {top, left};24 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .wait(10000)6 .pressKey('shiftLeft+left+right+left+right+a+b+c+d+left+left+left+left+left+left')7 .wait(10000);8});9import { Selector } from 'testcafe';10test('My first test', async t => {11 .typeText('#developer-name', 'John Smith')12 .click('#submit-button')13 .wait(10000)14 .pressKey('shift+left+right+left+right+a+b+c+d+left+left+left+left+left+left')15 .wait(10000);16});17import { Selector } from 'testcafe';18test('My first test', async t => {19 .typeText('#developer-name', 'John Smith')20 .click('#submit-button')21 .wait(10000)22 .pressKey('shiftRight+left+right+left+right+a+b+c+d+left+left+left+left+left+left')23 .wait(10000);24});25So, this is all about the Testcafe pressKey() method. In this article, we have discussed the Testcafe pressKey

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');6});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 const developerName = Selector('#developer-name');4 const osOption = Selector('#macos');5 const submitButton = Selector('#submit-button');6 .typeText(developerName, 'John Smith')7 .click(osOption)8 .click(submitButton);9});10import { Selector } from 'testcafe';11test('My first test', async t => {12 const developerName = Selector('#developer-name');13 const osOption = Selector('#macos');14 const submitButton = Selector('#submit-button');15 .typeText(developerName, 'John Smith')16 .click(osOption)17 .click(submitButton);18});19- Install Node.js (version 8 or higher)

Full Screen

Using AI Code Generation

copy

Full Screen

1import {Selector} from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');6});7import {Selector} from 'testcafe';8test('My first test', async t => {9 .typeText('#developer-name', 'John Smith')10 .click('#submit-button')11 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');12});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');6});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2const selector = Selector('input');3selector.shiftLeft(2);4import { Selector } from 'testcafe';5const selector = Selector('input');6selector.shiftRight(2);7import { Selector } from 'testcafe';8const selector = Selector('input');9selector.splice(2);10import { Selector } from 'testcafe';11const selector = Selector('input');12selector.substring(2);13import { Selector } from 'testcafe';14const selector = Selector('input');15selector.substr(2);16import { Selector } from 'testcafe';17const selector = Selector('input');18selector.toLowerCase();19import { Selector } from 'testcafe';20const selector = Selector('input');21selector.toUpperCase();22import { Selector } from 'testcafe';23const selector = Selector('input');24selector.trim();25import { Selector } from 'testcafe';26const selector = Selector('input');27selector.trimLeft();28import { Selector } from 'testcafe';29const selector = Selector('input');30selector.trimRight();

Full Screen

Using AI Code Generation

copy

Full Screen

1function shiftLeft(selector, offset) {2 return selector.addCustomMethods({3 shiftLeft: function() {4 return this.getBoundingClientRect().then(function(rect) {5 return {6 };7 });8 }9 });10}11function shiftLeft(selector, offset) {12 return selector.addCustomMethods({13 shiftLeft: function() {14 return this.getBoundingClientRect().then(function(rect) {15 return {16 };17 });18 }19 });20}21function shiftLeft(selector, offset) {22 return selector.addCustomMethods({23 shiftLeft: function() {24 return this.getBoundingClientRect().then(function(rect) {25 return {26 };27 });28 }29 });30}31function shiftLeft(selector, offset) {32 return selector.addCustomMethods({33 shiftLeft: function() {34 return this.getBoundingClientRect().then(function(rect) {35 return {36 };37 });38 }39 });40}41function shiftLeft(selector, offset) {42 return selector.addCustomMethods({43 shiftLeft: function() {44 return this.getBoundingClientRect().then(function(rect) {45 return {46 };47 });48 }49 });50}51function shiftLeft(selector, offset) {52 return selector.addCustomMethods({53 shiftLeft: function() {54 return this.getBoundingClientRect().then(function(rect) {55 return {56 };57 });58 }59 });60}

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Testcafe automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful