$ python setup.py build
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
// Based on Glacier's example: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/examples.html#Amazon_Glacier__Multi-part_Upload | |
var fs = require('fs'); | |
var AWS = require('aws-sdk'); | |
AWS.config.loadFromPath('./aws-config.json'); | |
var s3 = new AWS.S3(); | |
// File | |
var fileName = '5.pdf'; | |
var filePath = './' + fileName; | |
var fileKey = fileName; |
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(my_module). | |
-export([my_function/1, my_function/2]). | |
-export([infinite_loop/0, f/1, r/2, sort/1]). | |
-export([only_primes/1, is_prime/1]). | |
my_function(A) when is_integer(A) -> | |
my_function(A, 0); | |
my_function(A) when is_list(A) -> | |
my_function(list_to_integer(A), 0). |
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
/* Root build.gradle for Java, Maven, and IntelliJ with Maven central POM. Assumes GitHub. | |
You should eventually read through and understand this entire Gradle script. Last tried with IntelliJ 2017.1. | |
Quick start: | |
- Copy this file into a directory named for your project. | |
- Choose one Gradle integration mode. Once chosen, stick to it. | |
IntelliJ Gradle integration: | |
- Import the project directory as a Gradle project. | |
- To change Gradle files, enable auto-synchronize or click the synchronize button in the Gradle panel. |
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 std::clone::Clone; | |
use std::option::{Option, None, Some}; | |
use std::io::net::ip::{SocketAddr, IpAddr}; | |
use std::io::net::tcp::TcpStream; | |
use std::io::net::addrinfo::get_host_addresses; | |
use std::rc::Rc; | |
pub struct Connection { | |
addr: SocketAddr, | |
conn: Rc<TcpStream> |
Re: http://twitter.com/hondallica/status/436117998823165952
クソコードを見たとき: "Looking at this code is pure agony!"
同僚がバグを直してくれた時: "You are an angel sent to save me!"
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
// jQuery GC Helper - v0.9.5 | |
// | |
// Copyright (C) 2014 MURAOKA Taro | |
// Licensed under the MIT license. | |
(function(global, jQuery) { | |
var observer; | |
function callback(mutations) { |
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
# Description: | |
# 進捗 is the most important thing in your life | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: |
- 基本は迷ったら trait にしておけば良いと思います
- trait は一つの class に複数 mixin できますが、class は一つしか継承できません
- つまり、trait であれば mixin される class を気にしなくてよいですが、 abstract class にした場合は、extends される class が他に継承したい物が無いか気にする必要があります
- trait はコンストラクタを持つ事ができませんが、abstract class はコンストラクタを持つ事ができます
- 従って、型引数に制約をつけたい時や、共通のフィールドの初期化などがある場合は、abstract class にすると楽な場合があります。
- 以下に具体例を示します。良くある Java の enum を Scala で定義する場合の例です。