Skip to content

Instantly share code, notes, and snippets.

View fpg1503's full-sized avatar
🐥

Francesco fpg1503

🐥
View GitHub Profile
@fpg1503
fpg1503 / BoboLang.md
Last active February 21, 2018 19:25
BoboLang - A programming language consisting of 4 commands that translates to Brainfuck

BoboLang

A programming language consisting of 4 commands that translates to Brainfuck

Commands:

  • bo: move up
  • bO: move right
  • Bo: move down
  • BO: move right
@fpg1503
fpg1503 / candle.py
Created March 23, 2017 02:31
Candle - Programmatically light candles for your AppStore Submissions 🕯
# Install the Python Requests library:
# `pip install requests`
import requests
def light_candle(app_name, version, email="@"):
# Cria Vela
# POST http://www.velavirtual.com.br/asc/CriaVela.asp
@fpg1503
fpg1503 / CartographyBoilerplate.swift
Last active April 19, 2017 11:54
Cartography Boilerplate
import Cartography
final class <#Name#>View: UIView {
init() {
super.init(frame: .zero)
self.buildViews()
}
required init?(coder aDecoder: NSCoder) {
import requests
from bs4 import BeautifulSoup
all_symbols = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
url = "http://protext.herokuapp.com/?text=" + all_symbols
request = requests.get(url)
parsed_html = BeautifulSoup(request.text, "html.parser")
all_keys = list(all_symbols)
all_values = list(parsed_html.find('h1').text)
@fpg1503
fpg1503 / Promise.swift
Last active October 17, 2017 01:11
[WIP] Promises from scratch
import Foundation
import PlaygroundSupport
enum PromiseState<T> {
case pending
case fulfilled(T)
case rejected(Error)
var isPending: Bool {
switch self {
@fpg1503
fpg1503 / Immutable.swift
Created January 25, 2018 06:55
(a == 1 && a == 2 && a ==3).swift
//: Playground - noun: a place where people can play
struct EqualsMultiple<T: Equatable> {
let values: [T]
}
extension EqualsMultiple: ExpressibleByArrayLiteral {
typealias ArrayLiteralElement = T
init(arrayLiteral elements: T...) {
enum Year {
noPadding = "y",
twoDigits = "yy",
fourDigits = "yyyy"
}
enum Quarter {
number = "Q",
zeroPaddedNumber = "QQ",
qAndNumber = "QQQ",
@fpg1503
fpg1503 / remove_black_background.py
Created February 26, 2018 14:46
Remove image background and leave only white pixels
from PIL import Image
image = Image.open('img.png').convert("RGBA")
pixels = image.getdata()
new_pixels = list(map(lambda item: (255, 255, 255, 0) if item[0] < 250 and item[1] < 250 and item[2] < 250 else item, pixels))
image.putdata(new_pixels)
image.save("img2.png", "PNG")
@fpg1503
fpg1503 / safeProxy.js
Last active April 18, 2018 18:27
Safe Proxy
Object.prototype.toSafeProxy = function() {
const getter = (target, name, receiver) => {
const value = target[name]
if (value == null) {
return nullProxy(value)
} else if (typeof value === 'object') {
return value.toSafeProxy()
} else if (typeof value === 'function') {
return value
@fpg1503
fpg1503 / js.js
Last active August 29, 2018 02:23
jsStrings.js
// The goal is to create all letters using only !, [], {}, (), + and typeof
// Suggestions are welcome.
// Let's decrease the sizes!
// Big thanks to https://github.com/RedSparr0w, https://github.com/aemkei/jsfuck, and https://github.com/alcuadrado/hieroglyphy
const js = {
A: '(+![]+[][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]',
B: '(+![]+(![