Skip to content

Instantly share code, notes, and snippets.

View SungjinYoo's full-sized avatar

Sungjin Yoo SungjinYoo

  • Amazon
  • Vancouver
View GitHub Profile
@FunctionalInterface
interface Printer {
void print(String value);
}
class TextPrinter implements Printer {
void print(String value) {
System.out.println(value);
}
}
interface Function<T, R> {
R apply(T value);
}
// a function that returns the same type with the input type
Function<Integer, Integer> square = (num) -> {
return num * num;
}
System.out.println(square.apply(3)); // prints out 9
interface Consumer<T> {
void accept(T value);
}
// create Consumer by defining a class explicitly
class HelloWorldPrinter implements Consumer<String> {
public void accept(String name) {
System.out.println("Hello World! " + name);
}
@SungjinYoo
SungjinYoo / SampleNonFunctionalInterface.java
Created November 13, 2018 11:12
Sample non functional interface definition
interface SampleNonFunctionalInterface {
// there are two abstract methods!
int foo();
int bar();
}
@SungjinYoo
SungjinYoo / SampleFunctionalInterface.java
Last active November 13, 2018 11:18
Sample functional interface definition
interface SampleFunctionalInterface {
// I am the only abstract method in this interface
int foo();
}
interface AnotherSampleFunctionalInterface {
// I am the only abstract method in this interface
int foo();
@SungjinYoo
SungjinYoo / tistory_sample.py
Created November 8, 2018 01:01
tistory gist import sample
def __name__ == "__main__":
print("Hello World!")
#!/bin/bash
#==============================================================================
# GW-Kit
# @author : (origin) yunsang.choi(oddpoet@gmail.com)
# @author : (forked) jinkwon(master@bdyne.net)
# @src : (origin) https://gist.github.com/gists/3115022
# @src : (forked) https://github.com/Jinkwon/naver-gw-kit/
#-------
//
// command.c
// minishell
//
// Created by SungJinYoo on 11/10/14.
// Copyright (c) 2014 SungJinYoo. All rights reserved.
//
#include "command.h"
#include <string.h>
//
// main.c
// minishell
//
// Created by SungJinYoo on 11/7/14.
// Copyright (c) 2014 SungJinYoo. All rights reserved.
//
#include <libgen.h>