Skip to content

Instantly share code, notes, and snippets.

View yoophi's full-sized avatar
💭
Hi, there

Pyunghyuk Yoo yoophi

💭
Hi, there
View GitHub Profile
@yoophi
yoophi / gist:10cc61dc02bf2de41794
Created December 1, 2015 10:49 — forked from dittos/gist:6396622
Two concurrent sessions in Flask-SQLAlchemy
# coding=utf-8
import flask
from flask.ext.sqlalchemy import SQLAlchemy
app = flask.Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'
app.config['SQLALCHEMY_ECHO'] = True
db = SQLAlchemy(app)
log_db = SQLAlchemy(app, session_options={
@yoophi
yoophi / minimal_django_app.py
Created January 25, 2016 07:41
Minimal Django Application
# cd <PROJ_DIR>
# PYTHONPATH=. python minimal_django_app.py runserver
import os
from django.conf.urls import patterns
from django.http import HttpResponse
filepath, _ = os.path.splitext(__file__)
ROOT_URLCONF = os.path.basename(filepath)
@yoophi
yoophi / drag_drop.html
Created March 4, 2016 01:58
HTML5 drag and drop example
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
#boxA, #boxB {
}
#boxA { background-color: #6633FF; width:75px; height:75px; }
@yoophi
yoophi / index.ios.js
Created May 9, 2016 01:15
sample code
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
@yoophi
yoophi / MongoDbHelper.js
Created May 17, 2016 01:35 — forked from k33g/MongoDbHelper.js
Playing with node-mongodb-native and ECMAScript 6 and Express
/**
* Created by k33g_org on 24/10/14.
*/
import mongodb from 'mongodb';
import uuid from 'node-uuid';
/*
http://mongodb.github.io/node-mongodb-native/2.0/tutorials/crud_operations/
*/
@yoophi
yoophi / gist:7629b34ed1a4668cd71381f1a78c509c
Created May 17, 2016 05:57 — forked from lost-theory/gist:3772472
upload file with flask test client
import unittest
from app import app
from cStringIO import StringIO
class UploadTest(unittest.TestCase):
def setUp(self):
self.app = app
self.app.config['TESTING'] = True
self.client = self.app.test_client()
@yoophi
yoophi / config.py
Created May 23, 2016 07:11 — forked from klinkin/config.py
Using mandrill (mailchimp) service to send emails
from application.mail import mail_send
...
SECURITY_SEND_MAIL_FUNCTION = mail_send
...
FROM_EMAIL = 'dispatch@site.ru'
FROM_NAME = u'Site Admin'
@yoophi
yoophi / gulpfile.js
Last active June 14, 2016 05:24
compile coffeescript using gulp
var gulp = require('gulp')
var coffee = require('gulp-coffee');
var gutil = require('gulp-util');
var paths = {
coffee: ['./src/**/*.coffee']
};
gulp.task('coffee', function() {
gulp.src(paths.coffee)
.pipe(coffee({bare: true}).on('error', gutil.log))
@yoophi
yoophi / .gitignore
Created July 23, 2016 16:19 — forked from shuhei/.gitignore
An example `gulpfile.js` for CoffeeScript and Browserify. Note that this uses gulp-browserify's master. Update this as soon as 0.2.6 is out.
/node_modules
/build
@yoophi
yoophi / gist:2ba02a66de678f112bd0d62bc6ccc34d
Created August 19, 2016 02:04 — forked from alOneh/gist:2953365
RegexConverter for Flask app
# source http://stackoverflow.com/questions/5870188/does-flask-support-regular-expressions-in-its-url-routing
from flask import Flask
from werkzeug.routing import BaseConverter
app = Flask(__name__)
class RegexConverter(BaseConverter):
def __init__(self, url_map, *items):
super(RegexConverter, self).__init__(url_map)
self.regex = items[0]