Skip to content

Instantly share code, notes, and snippets.

@chanhee
chanhee / DateUtil.cs
Last active January 13, 2021 08:47
timestamp convert
public static class DateUtil
{
public static long CurrentTimestamp()
{
return DateToTimestamp(DateTimeOffset.UtcNow);
}
public static long DateToTimestamp(DateTimeOffset date)
@chanhee
chanhee / NumToKr.cs
Created July 6, 2020 07:57
Number to Korean
static string NumToKr(decimal val)
{
var exp = Math.Log10((double)val);
var baseLines = new Dictionary<int, string> {
[16] = "경",
[12] = "조",
[8] = "억",
[4] = "만"
};
#
#
# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
function submitForm($form) {
var defer = new $.Deferred();
var xhr = new XMLHttpRequest();
xhr.open($form.attr('method'), $form.attr('action'), true);
xhr.onload = function(e) {
if (xhr.status >= 200 && xhr.status < 300) {
defer.resolve(xhr);
}
else {
$(".elements-with-tooltips").on('show', function (e) {
if ('ontouchstart' in document.documentElement) e.preventDefault()
})
@chanhee
chanhee / jquery.rating.html
Last active August 29, 2015 14:02
jquery star rating sample
<html>
<head>
<title>rating</title>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/bootstrap/3.1/css/bootstrap.min.css">
<style>
.star-rating i {
font-size: 24px;
color: #ddd;
cursor: pointer;
}
menuCommandString,UI MenuString zh_CN
-------------------------------------
new,新建
newFromTemplate,从模板新建
open,打开
saveacopy,存储副本
Adobe AI Save For Web,存储为 Web 所用格式(W)
Adobe AI Save Selected Slices,存储选中的切片
revert,恢复
AI Place,置入(L)
@chanhee
chanhee / transform.py
Created October 22, 2013 07:00
가운데중심으로 정사각형재단 후 리사이즈
from wand.image import Image
with Image(filename='z:\\photo.jpg') as img:
width, height = img.size
offset_top = 0
offset_left = 0
if width > height:
offset_left = (width - height) / 2
size = height
elif height > width:
import sys
import time
def getTerminalSize():
import platform
current_os = platform.system()
tuple_xy=None
if current_os == 'Windows':
tuple_xy = _getTerminalSize_windows()
class Program
{
static void Main(string[] args) {
var password_text = "password_text";
var db = new Rfc2898DeriveBytes(password_text, 32, 10000);
var salt = db.Salt;
var hash = db.GetBytes(32);
var pass = Convert.ToBase64String(hash);
Console.WriteLine(pass);