Skip to content

Instantly share code, notes, and snippets.

View rsmelo92's full-sized avatar
🌎

Rafael Melo rsmelo92

🌎
View GitHub Profile
@rsmelo92
rsmelo92 / gist.js
Last active February 6, 2018 20:30
Enter Key Event jquery
$(‘input’).on(‘keypress’, (event)=> {
if(event.which === 13){
//Do Something
}
});
@rsmelo92
rsmelo92 / form.html
Created February 6, 2018 20:32
form
<form>
<input type=”text”>
<button type=”submit”>
Search!
</button>
</form>
@rsmelo92
rsmelo92 / form.js
Created February 6, 2018 20:33
form enter key event
$(‘form’).on(‘submit’, (event)=>{
event.preventDefault();
// Do what you want here
// In this case get input value
// Do a search
// Redirect to results page
});
@rsmelo92
rsmelo92 / recordScreen.sh
Created July 11, 2019 16:21
Script to record simulator screen as gif on macos
#!/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 -
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);
});
});
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);
});
describe('province', function() {
let asia;
beforeEach(function() {
asia = new Province(sampleProvinceData());
});
it('shortfall', function() {
expect(asia.shortfall).equal(5);
});
it('profit', function() {
@rsmelo92
rsmelo92 / long.js
Last active January 13, 2020 15:12
// *SMELL*
function convertTemperatures(farenheit, celcius, kelvin) {
const farenheitToCelcius = (5 / 9) * (farenheit - 32);
const farenheitToKelvin = ((farenheit - 32) / 1.8) + 273.15;
const celciusToFarenheit = (celcius * 1.8) + 32;
const celciusToKelvin = celcius + 273.15;
const kelvinToFarenheit = kelvin * 1.8 - 459.67;
const kelvinToCelcius = kelvin - 273.15;
// *SMELL*
function ballSports() {
const playersTypes = [
{name: "soccerPlayers", usesFeet: true, usesHands: false},
{name: "basketPlayers", usesFeet: false, usesHands: true},
{name: "volleyPlayers", usesFeet: false, usesHands: true},
{name: "hockeyPlayers", usesFeet: false, usesHands: false}
// WHAT IF WE NEED TO ADD {name: "baseballPlayers", usesFeet: false, usesHands: false} ?
];
// *SMELL*
function mutableData() {
let name = {
firstName: "Rafael",
lastName: "Melo"
};
name = `${name.firstName} ${name.lastName}`;
return name;
}