Skip to content

Instantly share code, notes, and snippets.

View nervouna's full-sized avatar
🚧
Old Dog New Tricks

大毛 nervouna

🚧
Old Dog New Tricks
  • 北京
View GitHub Profile
@nervouna
nervouna / long_press_menu_button.dart
Created June 29, 2023 17:19
Flutter popup menu button triggered by long press.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class LongPressMenuButton extends StatefulWidget {
final Widget child;
final List<PopupMenuEntry> items;
final bool enabled;
final bool hapticFeedback;
const LongPressMenuButton({
super.key,
@nervouna
nervouna / HTTPMethodOverrideMiddleware.py
Created March 29, 2017 19:41
Overriding HTTP method in flask with werkzeug middleware
from werkzeug import Request
class HTTPMethodOverrideMiddleware(object):
"""Overrides the request method by modifying werkzeug's REQUEST_METHOD environment.
Usage:
from flask import Flask
app = Flask(__name__)
app.wsgi_app = HTTPMethodOverrideMiddleware(app.wsgi_app)
@nervouna
nervouna / secretkey.py
Last active March 31, 2017 13:38 — forked from geoffalday/secretkey.py
How to generate a secret key with Python
# How to generate a secret key with Python
# via http://flask.pocoo.org/docs/quickstart/
import os
import binascii
os.urandom(24)
# Out: b'\x83[\x14\xa4s\xde\xdd\xed\xed/\xd0&-\xc6N\xd5\xb7\xf8O\xd5(\xce\xca,'
# Or if you want a prettier one:
binascii.hexlify(os.urandom(24))
<?php
// Variables used in this script:
// $summary - text title of the event
// $datestart - the starting date (in seconds since unix epoch)
// $dateend - the ending date (in seconds since unix epoch)
// $address - the event's address
// $uri - the URL of the event (add http://)
// $description - text description of the event
// $filename - the name of this file for saving (e.g. my-event-name.ics)
//
#!/bin/sh -ex
inhouseserver="http://inhouse.xxx.com/upload"
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
projectpath=$1
scheme=$2
projectname=$(basename "${projectpath}")