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
"*": | |
"runner": | |
scopes: | |
python: "python3" |
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
$ brew install nginx | |
$ cd /usr/local/etc/nginx | |
$ cp nginx.conf.default nginx.conf | |
$ cp nginx.conf nginx.conf.YYYYMMDD | |
$ vi nginx.conf |
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
$ export SECRET_KEY_BASE=`bundle exec rake secret` |
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 unicorn { | |
# nginxとunicornの連携 | |
# unicorn.rbで設定したunicorn.sockを指定 | |
server unix:{RAILS_PROJECT_ROOT}/tmp/sockets/unicorn.sock; #ソケットはこいつだ!socketsを追加 | |
} | |
server { | |
listen 8081; | |
server_name {PROJECTDOMAIN_FOR_LOCAL}; |
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
def fibonacci(n): | |
a, b = 0, 1 | |
for _ in range(n): | |
yield a | |
a, b = b, b+a |
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
# string | |
string = 'A string with what to be replaced.' | |
result = string.replace('what to be replaced', 'what to replace') | |
# regex | |
import re | |
result = re.sub(r'what to be replaced', 'what to replace', string) |
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
# Greatest common divisor of more than 2 numbers. Am I terrible for doing it this way? | |
def gcd(*numbers): | |
"""Return the greatest common divisor of the given integers""" | |
from fractions import gcd | |
return reduce(gcd, numbers) | |
# Least common multiple is not in standard libraries? It's in gmpy, but this is simple enough: | |
def lcm(*numbers): |
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/sh | |
dir="`pwd`" | |
# $dir以下の全てのファイルに対して行う。 | |
for file in `find $dir -type f`; | |
do | |
echo $file | |
# encoding_converter.sh自身だった場合にスキップする。 | |
if expr $file : ".*$0" > /dev/null; then | |
echo "$0 itself. skip!" | |
continue |
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
atom-text-editor .gutter { | |
color: #cccccc; | |
background-color: #353739; | |
} |
OlderNewer