Skip to content

Instantly share code, notes, and snippets.

@allenyang79
allenyang79 / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@allenyang79
allenyang79 / index.html
Last active August 29, 2015 14:24 — forked from anonymous/index.html
用refs 屬性去找到 對應的element-component
<!DOCTYPE html>
<html>
<head>
<script src="http://fb.me/react-with-addons-0.13.1.js"></script>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
Hello
@allenyang79
allenyang79 / api.py
Created May 29, 2016 18:12 — forked from alanhamlett/api.py
Serialize SQLAlchemy Model to dictionary (for JSON output) and update Model from dictionary attributes.
import uuid
import wtforms_json
from sqlalchemy import not_
from sqlalchemy.dialects.postgresql import UUID
from wtforms import Form
from wtforms.fields import FormField, FieldList
from wtforms.validators import Length
from flask import current_app as app
from flask import request, json, jsonify, abort
@allenyang79
allenyang79 / jinja2_file_less.py
Created June 8, 2018 03:34 — forked from wrunk/jinja2_file_less.py
python jinja2 examples
#!/usr/bin/env/python
#
# More of a reference of using jinaj2 without actual template files.
# This is great for a simple output transformation to standard out.
#
# Of course you will need to "sudo pip install jinja2" first!
#
# I like to refer to the following to remember how to use jinja2 :)
# http://jinja.pocoo.org/docs/templates/
#
@allenyang79
allenyang79 / celery.py
Created June 18, 2018 10:18 — forked from IrSent/celery.py
Celery Best Practices
# Safe Queue Celery App Settings
from __future__ import absolute_import, unicode_literals
from celery import Celery
app = Celery('some_project',
broker='amqp://',
backend='amqp://',
include=['some_project.tasks'])