This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# AND OR とかも直感的に使える | |
from sqlalchemy.sql.expression import * | |
# AND | |
Entry.query.filter(and_(Entry.id == 1, Entry.text == "entry")).all() | |
# => SELECT * FROM entries WHERE entries.id = 1 AND entries.text = "entry" | |
# OR | |
Entry.query.filter(or_(Entry.id == 1, Entry.text == "entry")).all() | |
# => SELECT * FROM entries WHERE entries.id = 1 OR entries.text = "entry" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#-*- coding:utf8 -*- | |
# paramiko の ProxyCommandの Sample | |
# ------------------------------------------------- | |
# | |
# ~/.ssh/config | |
# | |
# Host proxy-server | |
# User hoge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<style> | |
/* | |
初期表示が height: 546px | |
アドレスバーを消すと height: 615px になる場合 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Connpass API Wrapper | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
Requirement | |
- Requests (http://docs.python-requests.org/en/latest/) | |
See Also |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Point | |
attr_accessor :user | |
def initialize(user) | |
@user = user | |
end | |
def calc_point_num | |
unless self.user.point_num | |
return 101 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. ブロック内のコードを実行しない with ------- | |
# refs http://stackoverflow.com/questions/12594148/skipping-execution-of-with-block | |
import sys | |
import inspect | |
class SkipContext: | |
def __enter__(self): | |
# 1. SkipContextの外側のframeを取得 | |
self.frame, _, _, _, _, _ = inspect.getouterframes(inspect.currentframe())[1] |
OlderNewer