Skip to content

Instantly share code, notes, and snippets.

@kiichi
kiichi / 0_reuse_code.js
Created August 23, 2014 02:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kiichi
kiichi / Countdown Clock
Created September 8, 2014 15:04
Set targetDate and calculate countdown until specific date in JavaScript
<html>
<body style="background-color:gray">
<div class="col-md-6 col-md-offset-3">
<p class="lead ultra-bold" style="color: #fff; text-align: center; margin-top: 17px; font-size: 36px;">
<span id="ct-days"></span><span style="color: #b5e2e4;">DAYS</span>
<span id="ct-hours"></span><span style="color: #b5e2e4;">HOURS</span>
<span id="ct-mins"></span><span style="color: #b5e2e4;">MINS</span>
</p>
</div>
<script>
@kiichi
kiichi / JavaScript Benchmark Function
Created December 26, 2014 18:44
JavaScript Benchmark Function
//--------------------------------------------------------------------------------------------------
// show benchmark result of function
// e.g. benchMe(heavyFunc,null,5)
function benchMe(myFunc, myArgs, cnt){
if (!cnt || cnt <= 0){
cnt = 1;
}
var startTime = (new Date()).getTime();
for (var i=0; i<cnt; i++){
myFunc(myArgs);
@kiichi
kiichi / JintTest.js
Created February 2, 2015 16:57
Jint - Manipulating Object using JavaScript via .NET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Jint;
//https://github.com/sebastienros/jint
namespace JintTest {
public class Person {
public string Name;
@kiichi
kiichi / MyAppContext.cs
Last active August 29, 2015 14:15
.NET Entity Framework Application Context and Initializer with Seed function example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Validation;
using System.Data.Entity.InfrastMyAppructure;
using System.Configuration;
namespace MyCompany.HR {
@kiichi
kiichi / .bash_profile
Created March 6, 2015 16:16
.bash_profile
export SVN_EDITOR=vim
export PATH=$PATHexport PATH=$PATH::/Applications/MAMP/Library/bin/
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
alias less='less -r'
alias rm='rm -i'
##How to tune up javascript
Your app is slow? Try this below.
1. Use Chrome Prifle
1. Run the profiler first
1. Build a hypothsis
1. Apply change
1. Judge if it's improve it (or worth to change to take a risk. e.g. drawback in readability)
@kiichi
kiichi / iseismometer.php
Created April 23, 2015 20:18
This is a sample script when you push data from iSeismometer app to your own server. See all $_GET[] to find out parameters if you translate it into other platforms. If you create another translator, let me know! Thank you
<?php
//==========================================================================================
// iSeismometer Data Receiver version 1.0
// I released this program as public domain. Feel free to use this at your own risk.
// - by Kiichi 2009/02/16
//==========================================================================================
/*
CREATE TABLE IF NOT EXISTS `signals` (
`signal_id` int(11) NOT NULL auto_increment,
`device_id` varchar(50) NOT NULL,
@kiichi
kiichi / CustomValidationStatus.cs
Last active August 29, 2015 14:22
JavaScript base Custom Validator example in .NET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace MyTest
{
public class eStatus
{
@kiichi
kiichi / Patient.cs
Last active August 29, 2015 14:22
Unit Test with .NET MVC and Moq for JsonResult object
using System;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
using System.Web.Mvc;
namespace MoqTest {
public class Patient {
public string FirstName;
public string LastName;