Skip to content

Instantly share code, notes, and snippets.

View polotto's full-sized avatar

Ângelo Polotto polotto

View GitHub Profile
@polotto
polotto / CORS
Created September 19, 2022 12:40
is there any way to pass cors policy:
https://medium.com/@dtkatz/3-ways-to-fix-the-cors-error-and-how-access-control-allow-origin-works-d97d55946d9
https://joke-api-strict-cors.appspot.com/random_joke
https://github.com/Rob--W/cors-anywhere
https://github.com/Rob--W/cors-anywhere/issues/39
https://cors-anywhere.herokuapp.com/
@polotto
polotto / duplicate_line_xcode.md
Created March 24, 2020 18:55 — forked from emotality/duplicate_line_xcode.md
Xcode - Duplicate Line key binding

Xcode line duplicate

Bind keys to duplicate lines in Xcode

  1. Open below directory in Finder with Cmnd + Shift + G
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/
@polotto
polotto / client.py
Created October 23, 2019 18:59 — forked from yoavram/client.py
Example of uploading binary files programmatically in python, including both client and server code. Client implemented with the requests library and the server is implemented with the flask library.
import requests
#http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
url = "http://localhost:5000/"
fin = open('simple_table.pdf', 'rb')
files = {'file': fin}
try:
r = requests.post(url, files=files)
print r.text
docker container run -it debian bash
#!/bin/python
# References:
# https://stackoverflow.com/a/15502713/6846888
# http://python-notes.curiousefficiency.org/en/latest/python3/text_file_processing.html
import os
import sys
path = os.path.dirname(__file__)
@polotto
polotto / format_big_json.sh
Created September 27, 2019 13:56
Format big json files (> 30mb)
# https://stackoverflow.com/questions/19875218/best-way-to-format-large-json-file-30-mb
cat ugly.json | python -mjson.tool > pretty.json
@polotto
polotto / Messages.java
Created September 18, 2019 20:51 — forked from jonikarppinen/Messages.java
Example of using message resources in Spring Boot service layer code, in as simple way as possible (hopefully!)
package com.company.project.components;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.Locale;
@polotto
polotto / MVPImplementation
Last active November 10, 2018 18:13
Simple way to implement the MVP pattern
interface BaseContract {
showProgress()
hideProgress()
}
interface Contract extends BaseContract {
interface View {