Skip to content

Instantly share code, notes, and snippets.

@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 / .vimrc
Last active February 23, 2016 20:33
.vimrc
set noautoindent
set ignorecase
set shell=sh
set showmatch
set showmode
set shiftwidth=4
set tabstop=4
set edcompatible
set nocompatible
set magic
@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;
@kiichi
kiichi / swift-slack.swift
Created June 28, 2015 15:51
Swift Slack Integration
// icon
// http://www.emoji-cheat-sheet.com/
// for test use direct message e.g. @kiichi
let payload = "payload={\"channel\": \"#dev\", \"username\": \"bot\", \"icon_emoji\":\":calling:\", \"text\": \"hello\"}"
let data = (payload as NSString).dataUsingEncoding(NSUTF8StringEncoding)
if let url = NSURL(string: "https://hooks.slack.com/services/(your slack incoming webhook url)")
{
var request = NSMutableURLRequest(URL: url)
request.HTTPMethod = "POST"
@kiichi
kiichi / pdfkit-node-http.js
Created June 30, 2015 13:30
PDFKit Node Http Server
var http = require('http');
var fs = require('fs');
var PDFDocument = require('pdfkit');
function handleRequest(req, res){
var doc = new PDFDocument();
doc.pipe(res);
doc.fontSize(25).text('pdf server - requested URL:' + req.url, 100, 80);
doc.save().moveTo(100, 150).lineTo(100, 250).lineTo(200, 250).fill("#FF3300");
doc.circle(280, 200, 50).fill("#6600FF").restore();