This file contains 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
$(‘input’).on(‘keypress’, (event)=> { | |
if(event.which === 13){ | |
//Do Something | |
} | |
}); |
This file contains 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
<form> | |
<input type=”text”> | |
<button type=”submit”> | |
Search! | |
</button> | |
</form> |
This file contains 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
$(‘form’).on(‘submit’, (event)=>{ | |
event.preventDefault(); | |
// Do what you want here | |
// In this case get input value | |
// Do a search | |
// Redirect to results page | |
}); |
This file contains 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
#!/bin/bash | |
cd $HOME/Documents/Record_screen | |
echo "Recording. To stop and save it press CTRL+C" | |
xcrun simctl io booted recordVideo out.mov | |
ffmpeg -i out.mov -vf scale=320:-1 -r 10 "record_"$(date '+%W_%Y_%X').gif | |
rm out.mov | |
open $HOME/Documents/Record_screen | |
cd - |
This file contains 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
describe('province', function() { | |
it('shortfall', function() { | |
const asia = new Province(sampleProvinceData()); | |
expect(asia.shortfall).equal(5); | |
}); | |
it('profit', function() { | |
const asia = new Province(sampleProvinceData()); | |
expect(asia.profit).equal(230); | |
}); |
This file contains 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
describe('province', function() { | |
const asia = new Province(sampleProvinceData()); // DON'T DO THIS! | |
it('shortfall', function() { | |
expect(asia.shortfall).equal(5); | |
}); | |
it('profit', function() { | |
expect(asia.profit).equal(230); | |
}); | |
}); |
This file contains 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
describe('province', function() { | |
let asia; | |
beforeEach(function() { | |
asia = new Province(sampleProvinceData()); | |
}); | |
it('shortfall', function() { | |
expect(asia.shortfall).equal(5); | |
}); | |
it('profit', function() { |
This file contains 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
// *SMELL* | |
function tc(f) { | |
return (5 / 9) * (f - 32); | |
} | |
// *REFACTORED* | |
function toCelsius(farenheit) { | |
return (5 / 9) * (farenheit - 32); | |
} |
This file contains 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
// *SMELL* | |
function sumOfPowers() { | |
let firstPower; | |
for (let index = 1; index < 3; index++) { | |
firstPower = firstPower * number; | |
} | |
let secondPower; | |
for (let index = 1; index < 3; index++) { | |
secondPower = firstPower * number; |
This file contains 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
// *SMELL* | |
function filterCurseWords(words) { | |
for (let index = 0; index < words.length; index++) { | |
if(words[index] === "curse word"){ | |
words.splice(index) | |
} | |
} | |
return words; | |
} |
OlderNewer