Skip to content

Instantly share code, notes, and snippets.

View longfin's full-sized avatar

Swen Mun longfin

View GitHub Profile
# coding=utf-8
from __future__ import absolute_import
from boto3 import Session
from flask import current_app
from dodo.app import app
known_devices = {
class Car:
def __init__(self, type):
self.type = type
class License:
def __init__(self, driver_name):
self.driver_name = driver_name
def print(self):
print("{}의 {}종 면허입니다.".format(self.driver_name, self.LICENSE_TYPE))
@longfin
longfin / todo.html
Created October 7, 2014 02:02
react-tutorial
<!DOCTYPE html>
<html>
<head>
<style>
span.done {
text-decoration: line-through;
}
</style>
</head>
<body>
@longfin
longfin / gist:2405176b938ee6d816d0
Last active August 29, 2015 14:06
파이썬 서버 실행법
1. `Win` + `R` 키나 `시작` > `실행` 버튼을 눌러 `cmd` 를 입력합니다.
2. 실행된 창에 `cd <프로젝트 디렉토리>` 를 입력하고 엔터를 입력합니다.
- (e.g. `C:\Users\Student1\포트폴리오` 가 프로젝트 디렉토리인 경우 `cd C:\Users\Student1\포트폴리오`)
- 프로젝트 디렉토리는 `app.py` 와 `template` 등의 디렉토리가 보이는 디렉토리를 말합니다.
3. `python app.py` 를 입력하고 엔터를 입력합니다.
- 이 때 `내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는 배치파일이 아닙니다.` 라는 메시지가 뜨면 python 을 설치해야합니다.
4. 웹 브라우저를 열어 `http://localhost:5000` 을 입력합니다.
<link rel="import" href="../chart-js/chart-js.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@longfin
longfin / gist:4942759
Created February 13, 2013 06:52
testing...
from functools import wraps
from collections import namedtuple
from sqlalchemy.schema import Column
from sqlalchemy.sql import or_, expression as expr
from sqlalchemy.sql.expression import literal, ColumnClause
from sqlalchemy.types import String, Integer
from sqlalchemy.orm.query import Query
from sqlalchemy.orm.attributes import InstrumentedAttribute
from flask import request
#Stack is LIFO(Last In First Out)
#Queue is FIFO(First In First Out)
import sys
stack = [] #Stack create
queue = [] #Queue create
def main():
print '1. Insert Stack'
print '2. Delete Stack'
@longfin
longfin / gist:3865301
Created October 10, 2012 12:26
defentity
(defmacro defentity [type args & body]
(let [name (docname type)
constructor (symbol (str type "/create"))
fn-get-by-id (symbol (str "get-" name "-by-id"))
fn-get (symbol (str "get-" name))
fn-gets (symbol (str "get-" name "s"))
mc-with-col (symbol (str "with-" name "s"))]
`(do
(defrecord ~type ~args
~@body)
@longfin
longfin / gist:3237565
Created August 2, 2012 14:44
external-url-for
(defmacro external-url-for [& args]
`(let [url# (url-for ~@args)]
(str (name (:scheme *request*))
"://"
(:server-name *request*)
":"
(:server-port *request*)
url#)))
@longfin
longfin / protocol.clj
Created July 10, 2012 16:31
protocol example
(defprotocol IDocumentable
"Representable protocol for mongodb's document name"
(docname [e]))
(defprotocol IEntity
"Protocol of whole entity."
(add! [e])
(edit! [e])
(remove! [e]))