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
<?php | |
/** | |
* 複数の配列から一つずつ要素を取得して、指定した個数分要素を取得したら終了 | |
*/ | |
$ary = [ | |
'a' => ['a1', 'a2', 'a3', 'a4'], | |
'b' => ['b1', 'b2', 'b3'], | |
'c' => ['c1', 'c2'], | |
'd' => ['d1', 'd2', 'd3', 'd4'], | |
]; |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<phpunit | |
backupGlobals="false" | |
backupStaticAttributes="false" | |
strict="true" | |
colors="true" | |
verbose="true"> | |
<testsuites> | |
<testsuite name="Version"> |
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
<script src="http://gist-it.appspot.com/github/tadasy/sample_travis_memcached/blob/master/.travis.yml"></script> |
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
#!/bin/bash | |
# フィルタリングルールを消去する | |
/sbin/iptables -F | |
# デフォルトポリシーを設定 | |
/sbin/iptables -P INPUT DROP | |
/sbin/iptables -P FORWARD DROP | |
/sbin/iptables -P OUTPUT DROP |
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
# Repeated applications of the hash make brute force (even with a compromised | |
# database and site key) harder, and scale with Moore's law. | |
# | |
# bq. "To squeeze the most security out of a limited-entropy password or | |
# passphrase, we can use two techniques [salting and stretching]... that are | |
# so simple and obvious that they should be used in every password system. | |
# There is really no excuse not to use them." http://tinyurl.com/37lb73 | |
# Practical Security (Ferguson & Scheier) p350 | |
# | |
# A modest 10 foldings (the default here) adds 3ms. This makes brute forcing 10 |
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
module ModelClassMethods | |
# This provides a modest increased defense against a dictionary attack if | |
# your db were ever compromised, but will invalidate existing passwords. | |
# See the README and the file config/initializers/site_keys.rb | |
# | |
# It may not be obvious, but if you set REST_AUTH_SITE_KEY to nil and | |
# REST_AUTH_DIGEST_STRETCHES to 1 you'll have backwards compatibility with | |
# older versions of restful-authentication. | |
def password_digest(password, salt) | |
digest = REST_AUTH_SITE_KEY |
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 LoginController < ApplicationController | |
filter_parameter_logging :password | |
end |