Skip to content

Instantly share code, notes, and snippets.

View not-for-me's full-sized avatar
☺️
Fun coding time!

Woojin.joe not-for-me

☺️
Fun coding time!
View GitHub Profile

Mac OS X 터미널에서 Sublime Text 2 실행하기

Sublime Text 2는 subl(왜 sublime이 아닌지는 의문)이라는 CLI(Command-lime interface)을 갖고있다. 이 유틸리티는 디폴트로 설치되는 다음과 같은 폴더에 위치한다.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

설치

물론 저 폴터에 있는 subl을 바로 사용하면 되겠지만 편리하게 사용할 수 있는 두가지 방법을 적어본다.

@not-for-me
not-for-me / CaseClass.scala
Last active December 28, 2015 08:49
Scala의 케이스 클래스 특징~
// 스칼라의 문법인 케이스 클래스와 패턴 매칭 코드로 살펴보기
// regular, non-encapsulated data structures 가 필요할 때 케이스 클래스 사용
// Programming In Scala 15장 예제 코드로 구성 됨
abstract class Expr
case class Var(name: String) extends Expr
case class Number(num: Double) extends Expr
case class UnOp(operator: String, arg: Expr) extends Expr
case class BinOp(operator: String, left: Expr, right: Expr) extends Expr
@not-for-me
not-for-me / Equaltest.scala
Created December 28, 2015 08:26
In Scala, '==' is equals with 'equals()'. Try to execute below code sniff on the repl.
case class Dummy(a: Int, b: Double)
val obj1 = Dummy(1, 10.0)
val obj2 = Dummy(2, 20.0)
val obj3 = Dummy(1, 10.0)
obj1 == obj2
obj1 equals obj2
obj1 == obj3
@not-for-me
not-for-me / EqualTest.java
Created December 28, 2015 08:14
In Java, 'equals' and '==' test code
public class EqualTest{
public static void main(String []args){
new EqualTest().test();
}
private void test() {
Dummy obj1 = new Dummy(1, 10.0);
Dummy obj2 = new Dummy(2, 20.0);
Dummy obj3 = new Dummy(1, 10.0);
System.out.println("obj1 == obj2: " + (obj1 == obj2) + " / obj1.equals(obj2): " + obj1.equals(obj2) );
@not-for-me
not-for-me / tail_rec_exp.c
Last active November 4, 2015 03:26
tail recursion version: two's exponential function
int _twoExponential(int exponent, int acc) {
if ( exponent == 0 ) {
return acc;
}
acc *= 2;
return _twoExponential(--exponent, acc);
}
int exponential(int num) {
@not-for-me
not-for-me / Rational.scala
Created October 5, 2015 06:33
스칼라의 클래스 선언 샘플
package nfm.ex06
/**
* Programming In Scala 2/e List 6.5 코드
* 분수 Class
* @param n 분자
* @param d 분모
*/
/* 스칼라에 있는 문법: Class에서 기본 생성자 선언 가능
float tempC;
int reading;
int tempPin = 0;
void setup()
{
Serial.begin(9600);
analogReference(INTERNAL);
}
void loop()
{
//Arduino Sample Code for SHT1x Humidity and Temperature Sensor
//www.DFRobot.com
//Version 1.0
#include <SHT1x.h>
// Specify data and clock connections and instantiate SHT1x object
#define dataPin 10
#define clockPin 11
SHT1x sht1x(dataPin, clockPin);
@not-for-me
not-for-me / writeXLS.py
Created October 20, 2014 07:42
Make Excel File with Python
# coding: utf-8
from xlwt import Workbook
book = Workbook()
sheet1 = book.add_sheet(u'Ex Sheet1')
sheet2 = book.add_sheet(u'Ex Sheet2')
sheet1.write(0,0, u'Name')
sheet1.write(0,1, u'Sex')