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
from django import template | |
import re | |
register = template.Library() | |
@register.simple_tag | |
def youtube_embed(video): | |
YOUTUBE_REGEX = r'(https?://)?(www\.)?(youtube|youtu|youtube-nocookie)\.(com|be)/(watch\?v=|embed/|v/|.+\?v=)?([^&=%\?]{11})' | |
def _get_id(video): |
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
##### add apt key | |
## get ther key | |
http://nginx.org/keys/nginx_signing.key | |
## create key file | |
vi nginx_signing.key | |
## paste key content | |
↓ | |
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
Version: GnuPG v1.4.11 (FreeBSD) |
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
## vm 起動 | |
vagrant up | |
## vm 停止 | |
vagrant halt | |
## vm 休止 | |
vagrant suspend | |
## vm 削除 |
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
upstream some_app_server { | |
server 127.0.0.1:9393; | |
} | |
server { | |
listen 80; | |
server_name my-upload-endpoint.com ; | |
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 resize: | |
def __init__(self, input_image): | |
self.input_image = input_image | |
self.output_image = StringIO() | |
def resize_image(self, width=400, height=300, aspecto_width=4, aspect_height=3): | |
""" | |
resize image | |
:param self | |
:param width default=200px |
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
FACEBOOK_API_PICTURE_URL = "https://graph.facebook.com/#id#/picture/" | |
class util_fb: | |
def __init__(self, access_token=None): | |
self.access_token = access_token | |
self.user_agent = PROJECT_NAME + '/' + PROJECT_VERSION | |
self.error_code = 0 | |
self.message = "" | |
def get_people_picture(self, fb_id, width=200, height=200): |
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
IE, Firefoxの最新版だとクロスドメイン制約のため、S3からWEBフォントをダウンロードしようとするとエラーとなる。 | |
>> 対処方法 | |
bucket の [properties] - [Permissions] の [add cors configuration]に設定を追加 | |
<?xml version="1.0" encoding="UTF-8"?> | |
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
<CORSRule> | |
<AllowedOrigin>*</AllowedOrigin> #### ←ここに許可するドメインを追加 *はワイルドカードなので全許可 | |
<AllowedMethod>GET</AllowedMethod> |
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.<meta> viewportを除く | |
2..container クラスのwidth属性を統一して!importantを追加 | |
.container { | |
max-width: none !important; | |
width: 970px; | |
} | |
3..navbar を使っている場合は、colloapsing 属性を取り除く |
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
.rotate { | |
-webkit-transform: rotate(90deg); | |
-moz-transform: rotate(90deg); | |
-o-transform: rotate(90deg); | |
-ms-transform: rotate(90deg); | |
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); | |
transform: rotate(90deg); | |
} |
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
#============================================================================== | |
## | |
## OPENSSL Nginx (ubuntu) | |
## | |
#============================================================================== | |
####OpenSSL の設定(自己証明書生成) | |
mkdir /etc/nginx/conf | |
cd /usr/local/nginx/conf | |
#CSRの生成 |
NewerOlder