Skip to content

Instantly share code, notes, and snippets.

View CubeDr's full-sized avatar

Hyuni Kim CubeDr

View GitHub Profile
@CubeDr
CubeDr / sqrt.c
Created October 4, 2021 03:57
square root
#include <stdio.h>
#define ABS(x) ((x) > 0 ? (x) : -(x))
double sqrt_babilonia(double num, double precision) {
if (num < 0) {
return -1;
}
double x, nx = num / 2;
@CubeDr
CubeDr / CountDown.java
Last active April 7, 2021 16:11
Count Down
package countdown;
import java.util.*;
import java.util.function.Consumer;
public class CountDown {
private int seconds;
private Timer timer;
private CountDownTask task;
@CubeDr
CubeDr / calculator_home_page.dart
Last active February 24, 2021 02:36
Flutter integer calculator
import 'package:calculator/constants.dart';
import 'package:flutter/material.dart';
class CalculatorHomePage extends StatefulWidget {
@override
_CalculatorHomePageState createState() => _CalculatorHomePageState();
}
class _CalculatorHomePageState extends State<CalculatorHomePage> {
int answer = 24;
@CubeDr
CubeDr / auto_match.dart
Last active April 17, 2020 12:09
Auto Match
import 'dart:math';
class Player implements Comparable<Player> {
String name;
String gender;
int level;
Player(this.name, this.gender, this.level);
@override
@CubeDr
CubeDr / Data.kt
Created March 19, 2020 02:27
Retrofit request response into RecyclerView
package com.google.temp
data class WinningPlace(
val gameType: String,
val shopName: String,
val address: String,
val lat: Double,
val lng: Double
)
@CubeDr
CubeDr / Basic Counter.kt
Created March 13, 2020 05:03
Kotlin-React project
package counter
import react.RBuilder
import react.RComponent
import react.RProps
import react.RState
class Counter : RComponent<RProps, RState>() {
override fun RBuilder.render() {
}
@CubeDr
CubeDr / DraftJS-Implementation.kt
Last active March 12, 2020 02:39
Importing Draft.js in Kotlin/JS
div { ... }
Editor {
attrs {
...
}
}
@CubeDr
CubeDr / Hangman.kt
Created January 28, 2020 13:48
Hangman Game
import java.io.File
val hangman = listOf("""
----
| |
| O
| /|\
| / \
|
------
@CubeDr
CubeDr / countSegments.kt
Last active October 20, 2019 06:01
문자열 세그먼트 나누기
tailrec fun countSegments(str: String, index: Int = 0, segments: Int = 0): Int =
if(index == -1) segments
else countSegments(str,
nextCharacter(str, index),
segments + 1)
@CubeDr
CubeDr / max_list.py
Last active October 11, 2019 16:28
두 리스트의 같은 위치의 원소 중 큰 값만으로 구성된 리스트
# Two lists have to have same length
list1 = [ 13, 34, 78, 54, 92 ]
list2 = [ 26, 84, 89, 64, 46 ]
# [ 26, 84, 89, 64, 92 ]
result = [max(list1[x], list2[x]) for x in range(len(list1))]