Skip to content

Instantly share code, notes, and snippets.

View k4zy's full-sized avatar

Kazuki Yoshida k4zy

  • Cookpad.Inc
  • Yebisu/Tokyo
View GitHub Profile

スコープ関数とデリゲーションについて

拡張関数について

kotlinは任意のクラスに後からメソッドを追加できます。これを拡張関数と呼びます。

fun String.print() {
  System.out.println(this)
}
Error detected while processing function <SNR>59_ShowMarks:
line 39:
E885: Not possible to change sign ShowMark76
Press ENTER or type command to continue
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button"
android:text="電話をかける"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
@RuntimePermissions
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
csv = <<'EOS'
勝海舟 コンパイラ C++プログラミング
勝海舟 コンパイラ Javaプログラミング
坂本龍馬 コンパイラ C++プログラミング
坂本龍馬 コンパイラ Ruby on Rails
坂本龍馬 データベース Ruby on Rails
坂本龍馬 データベース リレーショナルモデル
桂小五郎 コンパイラ Javaプログラミング
桂小五郎 コンピュータアーキテクチャ Javaプログラミング
桂小五郎 コンピュータアーキテクチャ オペレーティングシステム
extension Int {
var fizzbuzz: String {
var stuff = (self%3==0, self%5==0)
switch stuff {
case (true,false):
return "fizz"
case (false,true):
return "buzz"
case(true,true):
return "fizzbuzz"
NeoBundle 'tpope/vim-dispatch'
NeoBundle 'thoughtbot/vim-rspec'
let g:rspec_command = 'Dispatch rspec {spec}'
nmap <silent><leader>ff :call RunNearestSpec()<CR>
package jp.co.denso.android.denmobi.others;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.net.InetAddress;
import java.util.ArrayList;
def quicksort(list):
if len(list) <= 1:
return list
pivot = list[0]
left = []
right = []
for val in list[1:len(list)]:
if val < pivot:
left.append(val)
else:
import math
import string
class RectangularGrid:
def countRectangles(self, width, height):
counter = 0
for i in range(1,width+1):
for j in range(1,height+1):
if i != j:
counter += ( (1+ (width-i)) * (( 1 + (height- j))) )