Skip to content

Instantly share code, notes, and snippets.

View toaco's full-sized avatar
🎯
Focusing

toaco toaco

🎯
Focusing
View GitHub Profile
package main
import (
"fmt"
"sync"
)
var messages = [][]string{
{
"The world itself's",
@quachngocxuan
quachngocxuan / learnenough-flask.md
Last active January 8, 2018 06:57
Learn enough to be dangerous - Flask

Learn enough to be dangerous - Flask

Based on Tutorialspoint - Flask.

CORE CONCEPTS

Intro

  • Flask is a web application framework written in Python.
  • Flask is based on Werkzeug WSGI toolkit and Jinja2 template engine.
  • Flask is often referred to as a micro framework. It aims to keep the core of an application simple yet extensible. Flask does not have built-in abstraction layer for database handling, nor does it have form a validation support. Instead, Flask supports the extensions to add such functionality to the application. Some of the popular Flask extensions are discussed later in the tutorial.
@leohxj
leohxj / .cz-config.js
Last active May 19, 2023 03:49
cz-customizable with emoji
'use strict';
module.exports = {
types: [
{
value: 'WIP',
name : '💪 WIP: Work in progress'
},
{
@toaco
toaco / get_all_resources.py
Created July 18, 2017 09:11
list all resource requested by a request
# list all resource requested by a request
from ghost import Ghost
ghost = Ghost()
def get_all_resources(url):
with ghost.start() as session:
page, extra_resources = session.open(url)
for extra_resource in extra_resources:
@javilobo8
javilobo8 / download-file.js
Last active April 9, 2024 12:01
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@nmarley
nmarley / README.md
Last active May 13, 2020 21:46
Python JSON Schema validation example

test json schema validation

Setup Virtualenv

$ virtualenv ./venv
$ ./venv/bin/pip install -r requirements.txt

Test/Play:

$ ./venv/bin/python ./v.py

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@bgusach
bgusach / multireplace.py
Last active April 23, 2024 18:46
Python string multireplacement
def multireplace(string, replacements, ignore_case=False):
"""
Given a string and a replacement map, it returns the replaced string.
:param str string: string to execute replacements on
:param dict replacements: replacement dictionary {value to find: value to replace}
:param bool ignore_case: whether the match should be case insensitive
:rtype: str
"""
# Java
*.class
*.jar
*.war
*.ear
# Eclipse
.project
.classpath
.settings
@claymcleod
claymcleod / pycurses.py
Last active April 25, 2024 14:36
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()