This file contains hidden or 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
/** | |
* Get YouTube ID from various YouTube URL | |
* @author: takien | |
* @url: http://takien.com | |
* For PHP YouTube parser, go here http://takien.com/864 | |
*/ | |
function YouTubeGetID(url){ | |
var ID = ''; | |
url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/); |
This file contains hidden or 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
import urllib2 | |
from django.template.defaultfilters import slugify | |
from django.core.files.base import ContentFile | |
from django.dispatch import receiver | |
from avatar.models import Avatar | |
from allauth.account.signals import user_signed_up | |
This file contains hidden or 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
.alert, .badge, .breadcrumb, .btn, .form-control, .input-gruop, .label, .lead, .list-group, .nav-pills, .nav-tabs, .navbar, .no-thank-yu, .pager, .pagination, .panel-heading, .panel-title, .popover, .tooltip { | |
font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,"ヒラギノ角ゴ ProN W3","Hiragino Kaku Gothic ProN","メイリオ",Meiryo,sans-serif; | |
} | |
body { | |
font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,"游ゴシック",YuGothic,"ヒラギノ角ゴ ProN W3","Hiragino Kaku Gothic ProN","メイリオ",Meiryo,sans-serif; | |
font-size: 16px; | |
line-height: 1.42857; | |
} |
This file contains hidden or 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
#!/bin/sh -x | |
# ================================== | |
# iptables default configuration script | |
# | |
# - this locks down our servers port access | |
# ================================== | |
# install fail2ban | |
sudo apt-get update |
This file contains hidden or 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
// Two ways to serve transparent GIF | |
var buf = new Buffer([ | |
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, | |
0x80, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x2c, | |
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, | |
0x02, 0x44, 0x01, 0x00, 0x3b]); | |
res.send(buf, { 'Content-Type': 'image/gif' }, 200); |
This file contains hidden or 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
(require 'cl) | |
(require 'deferred) | |
(require 'http-get) | |
(require 'xml) | |
(require 'url) | |
(setq aoj-url "http://judge.u-aizu.ac.jp/onlinejudge") | |
(setq aoj-passwd "***") | |
(setq aoj-id "***") |
This file contains hidden or 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
(function(A, E) { | |
function sa(f) { | |
return f << 1 | |
} | |
function ta(f) { | |
return f << 1 | |
} | |
function U() { | |
return E.pointerLockElement === y || E.mozPointerLockElement === y || E.webkitPointerLockElement === y | |
} |
This file contains hidden or 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
m, s = divmod(seconds, 60) | |
h, m = divmod(m, 60) | |
print "%d:%02d:%02d" % (h, m, s) |
This file contains hidden or 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 func isValidEmail(string: String) -> Bool { | |
println("validate calendar: \(string)") | |
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}" | |
var emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx) | |
let result = emailTest?.evaluateWithObject(string) | |
return result! | |
} |
This file contains hidden or 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
let manager = NSFileManager.defaultManager() | |
let list = manager.contentsOfDirectoryAtPath("/spam/ham/egg", error: nil)! | |
for path in list { | |
println(path as NSString) | |
} |