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
package main | |
import ( | |
"net/http" | |
"os/exec" | |
"log" | |
) | |
func execOSAScript(osaScript string) { | |
err := exec.Command("osascript", "-e", osaScript).Start() |
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
function(o){ | |
var a = []; | |
for(var b in o){a.push(b+"="+o[b]);} | |
return a.join(','); | |
}; |
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
var SomeClass = (function(){ | |
var _private = "this is private"; | |
var constructor = function(){ | |
this.public = "this is public"; | |
}; | |
constructor.prototype.say = function(){ | |
console.log(this.public); | |
console.log(_private); | |
}; | |
return constructor; |
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
Application.Resourcesの使い方 | |
アプリケーション全体で使いたい定数などがある時に非常に便利です。 | |
この方法だと、数値や文字列などだけではなく、 | |
自作のオブジェクトもインスタンス化して保持しておくことができます。 | |
アプリケーションをテンプレートから作成した時に自動的に作成されている App.xaml を開いてみると、 | |
Application.Resources 中に | |
<Application.Resources> |
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
ICPCのための平面幾何問題について学んだこと | |
基本は「点」。点はx座標y座標がわかればよい。 | |
また、点があればベクトルを考えられる。ベクトルは原点からある点までの有向線分なので、点が一つあればベクトルを表現できる。 | |
円は点と半径がわかればいい。 | |
線分や直線は、それを通る点の対で表す。ただ、pairを使うのでなく、vectorを使った方が良いらしい。for文で端点をすべて回れたり、辞書準比較の演算子が最初からあるためらしい。 | |
単純多角形はvectorで表現。ただ、その多角形が反時計回りなのか時計回りなのかか決めておかないといけない。 | |
ベクトル計算のためには、ベクトルの加減算、スカラー倍、内積、外積が計算できると便利。 | |
自分でstruct pointとか定義してメソッド定義するんでも良いけれど、複素数クラスで加減算とスカラー倍まではデフォルトでできるので、それで代用する。 |
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
#include <iostream> | |
#define REP(i,n) for(int i = 0; i < (n); i++) | |
using namespace std; | |
const int YMAX = 1000; | |
const int MMAX = 10; | |
const int CMAX = 20; | |
int n; |
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 PixivAppSetting | |
attr_accessor :login_userid | |
attr_accessor :login_password | |
def initialize | |
@login_userid = "" | |
@login_password = "" | |
end | |
end |
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 PixivItemBase | |
attr_reader :title | |
attr_reader :creator | |
attr_reader :posted_date | |
attr_reader :caption | |
attr_reader :number_of_viewed | |
attr_reader :number_of_voted | |
attr_reader :score | |
attr_reader :tags | |
attr_reader :thumbnail_128 |
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
require 'rubygems' | |
require 'anemone' | |
opts = { | |
:skip_query_strings => true, | |
:depth_limit => 5, | |
} | |
Anemone.crawl("http://example.com/", opts) do |anemone| | |
anemone.on_every_page do |page| |
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
typedef int8 int8_t; | |
typedef int16 int16_t; | |
typedef int32 int32_t; | |
typedef int64 int364_t; | |
typedef uint8 uint8_t; | |
typedef uint16 uint16_t; | |
typedef uint32 uint32_t; | |
typedef uint64 uint64_t; | |
typedef int8_t int_least8_t; |