Skip to content

Instantly share code, notes, and snippets.

View hellosweta's full-sized avatar
🐢

Sweta hellosweta

🐢
View GitHub Profile
@hellosweta
hellosweta / gist:af54c938d27383761ceff5119d903994
Created March 19, 2019 18:47
Simulating input changes in Enzyme and Formik
const checkbox = form.find('input[name="agreementAccepted"]');
checkbox.simulate('change', {
persist: () => {},
target: {
checked: true, name: 'agreementAccepted'
}
});
const contactNameInput = form.find('input[name="contactName"]');
ssh-add -K ~/.ssh/id_rsa
@hellosweta
hellosweta / gist:ea5bef253c987bb94b73fe45145492e3
Created December 19, 2018 22:05
Write a file from an xml response
File.open('file/path/that/exists/file.xml', 'w') { |file| file.puts response }
@hellosweta
hellosweta / my_flatten.rb
Created May 22, 2017 04:33
A method that flattens nested arrays into a 1D array
def my_flatten(array)
flattened_array = []
array.each do |el|
if el.is_a?(Array)
flattened_array.concat(my_flatten(el))
else
flattened_array << el
end