Skip to content

Instantly share code, notes, and snippets.

@sousatg
sousatg / app.py
Created April 1, 2017 21:17
Tkinter multy frame
import tkinter as tk # python3
TITLE_FONT = ("Helvetica", 18, "bold")
class SampleApp(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
# the container is where we'll stack a bunch of frames
@sousatg
sousatg / index.html
Created May 2, 2017 15:56
Vue To-Do list
<div class="container" id="app">
<div class="row justify-content-md-center">
<div class="col">
<form>
<fieldset>
<legend>Add new To-Do</legend>
<div class="form-group">
<label>Title:</label>
<input type="text" class="form-control" v-model="newTask.title">
</div>
@sousatg
sousatg / index.html
Created May 4, 2017 10:14
Random Quote Machine
<div class="container">
<div class="row no-gutter">
<div class="col-md-10 offset-md-1">
<div id="quote-wrapper">
<div class="row">
<div class="col">
<blockquote>
<p>{{ quote.text }}</p>
<footer>— {{quote.author}}</footer>
</blockquote>
@sousatg
sousatg / index.html
Created May 4, 2017 23:18
Wikipedia Viewer
<div id="wikiViewer" class="container">
<div class="row no-gutters">
<div class="col-12">
<div class="search-wrapper">
<form class="form-inline search-form">
<div class="input-group col-xs-12 col-md-6 col-lg-6">
<input type="text" class="form-control" v-model="query">
<button class="btn btn-primary" type="submit" v-on:click="search"><i class="fa fa-search" aria-hidden="true"></i></button>
<button type="button" class="btn btn-danger" v-on:click="randomPage"><i class="fa fa-random" aria-hidden="true"></i></button>
</div><!-- ./ input-group -->
@sousatg
sousatg / gist:01b68236bc7b7ff31e34dc3972a881fa
Last active April 27, 2019 09:59
One liner to stop / remove all of Docker containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker network remove $(docker network ls -q)
@sousatg
sousatg / notas
Created June 16, 2017 10:50
Notas Magento2
Set the magento permissions
find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \; && chmod u+x bin/magento
@sousatg
sousatg / README.md
Created July 13, 2017 20:47 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

@sousatg
sousatg / app.py
Created August 10, 2017 16:49
Flask App
import sys
from pprint import pprint
import wtforms_json
from flask import Flask, g, request, redirect, url_for
from flask_marshmallow import Marshmallow
from flask_restful import Resource, Api
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import FlaskForm
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# http://assicanti.pt/category/uptec/
import PyPDF2
import re
from itertools import takewhile
@sousatg
sousatg / README.md
Created October 11, 2017 14:20 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \