Skip to content

Instantly share code, notes, and snippets.

View omrital's full-sized avatar
🚫
Social networks will destroy the world

Omri Tal omrital

🚫
Social networks will destroy the world
  • Tiberias, Israel
View GitHub Profile
require 'json'
languages = ["cs", "da", "de", "en", "es", "fi", "fr", "he", "hi", "it", "ja", "ko", "lt", "nl", "no", "pl", "pt", "ru", "sv", "th", "tr", "uk", "zh"]
keyToSearch=ARGV[0]
pathToSearch=ARGV[1]
destinationPath=ARGV[2]
puts "Start One App strings scripts..."
puts "............................."
@omrital
omrital / clean-classes.js
Last active March 21, 2019 17:18
clean classes
class ChatScreenPresenter {
function formatChatMessage(message) {
return `${message.sender}: ${message.content}`;
}
// ... more functions to format chat screen components
}
class CustomerDetailsScreenPresenter {
function formatCustomerAddress(address) {
@omrital
omrital / bad-class.js
Last active March 21, 2019 17:18
bad class
class StringUtils {
function formatChatMessage(message) {
return `${message.sender}: ${message.content}`;
}
function removeEmptySpaces(stringWithSpaces) {
return stringWithSpaces.replace(' ', '');
}
function formatCustomerAddress(address) {
@omrital
omrital / bad-names.js
Last active March 21, 2019 17:18
bad names
async function updateAdd(x) {
const updateAddReq = ReqMaker.make(new UpdateAddRoute(x));
try {
return await Sender.send(updateAddReq);
} catch(e)
throw new Error(e);
}
}
@omrital
omrital / bad-function.js
Last active March 21, 2019 17:18
bad function
async function onSaveCustomerDetailsPress() {
const name = nameInput.getText();
const lastName = lastNameInput.getText();
if (name.length === 0 || lastName.length === 0) {
const alert = new Alert.create('Please fill all fields');
alert.show();
} else {
try {
const request = new UpdateCustomerRequest(name, lastName);
await RequestDispatcher.dispatch(request);
@omrital
omrital / clean-functions.js
Last active March 21, 2019 17:18
clean functions
function onSaveCustomerDetailsPress() {
const name = nameInput.getText();
const lastName = lastNameInput.getText();
if (!isInputValid(name, lastName)) {
showAlert('Please fill all fields');
return;
}
saveCustomerDetails(name, lastName)
}
@omrital
omrital / meaningful-names.js
Last active March 21, 2019 17:17
meaningful names
async function updateAddress(customerId) {
const updateAddressRoute = new UpdateAddressRoute(customerId);
const UpdateAddressRequest = RequestBuilder.build(updateAddressRoute);
try {
return await RequestDispatcher.dispatch(UpdateAddressRequest);
} catch(error) {
throw new ApiRequestError(`Failed to update address for customer ${customerId}`, error);
}
}