Skip to content

Instantly share code, notes, and snippets.

@urstory
urstory / DatabaseHandler.java
Last active August 29, 2015 14:17
커스텀 List, 사용자 정의 어댑터, 입력, 삭제, 리스트보기
package examples.android.sqlite;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.util.ArrayList;
import java.util.List;
@urstory
urstory / MyBean.java
Created March 27, 2015 08:01
싱글턴 패턴.
public class MyBean{
private static MyBean instance = new MyBean();
private MyBean(){}
public static MyBean getInstance(){
return instance;
}
}
@urstory
urstory / gist:687e0956917d5ecd13ef
Created July 8, 2015 06:29
AlertDialog create
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage("OK를 누르시겠습니까?")
.setTitle("Alert Dialog")
.setPositiveButton("확인", new DialogInterface.OnClickListener() {
// 확인 버튼 클릭시 설정
public void onClick(DialogInterface dialog, int whichButton) {
Toast.makeText(MainActivity.this, "OK 버튼 클릭", Toast.LENGTH_SHORT).show();
}
})
.setNegativeButton("취소", new DialogInterface.OnClickListener() {
<!DOCTYPE html>
<html>
<head>
<script>
function LottoMachine(){
this.balls = Array(45);
this.mix = function(){
for(var i = 0; i < 45; i++){
this.balls[i] = i+1;
}
<!DOCTYPE html>
<html>
<head>
<script>
function Stack(){
this.array = new Array();
this.push = function(element){
this.array.push(element);
}
this.pop = function(){
<!DOCTYPE html>
<html>
<head>
<script>
function Student(name, kor){
this.name = name;
this.kor = kor;
}
var array = new Array();
@urstory
urstory / lotto.html
Last active September 18, 2015 02:03
lotto.html
<!DOCTYPE html>
<html>
<head>
<script>
function LottoMachine(){
this.balls = Array(45);
this.mix = function(){
for(var i = 0; i < 45; i++){
this.balls[i] = i+1;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script>
function LottoMachine(){
var balls;
var mixFlag = false;
this.setBalls = function(ballsParam){
@urstory
urstory / cal.html
Last active September 24, 2015 06:14
cal.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(document).ready(function () {
var date = new Date();
var currentYear = date.getFullYear();
var currentMonth = date.getMonth() + 1;
@urstory
urstory / cal.js
Created September 24, 2015 06:15
// jquery에서 선택자를 이용하여 찾은 결과에 함수를 호출하기 위하여
// $.fn 객체에 메소드를 추가하였다.
// $('div').currentCalendar();
// 라고 하면 달력이 div tag에 추가되서 보여진다.
$.fn.currentCalendar = function(options){
var date = new Date();
var currentYear = date.getFullYear();
var currentMonth = date.getMonth() + 1;
date.setDate(1);
// 0:일요일, 6:토요일