Skip to content

Instantly share code, notes, and snippets.

@k-maru
k-maru / fromToParameter.sql
Created March 5, 2016 11:01
from and to parameter range sql
(
1 = CASE WHEN :ValueFrom /*Number*/ IS NULL THEN 1
WHEN ColumnName >= :ValueFrom/*Number*/ THEN 1
ELSE NULL END
AND
1 = CASE WHEN :ValueTo/*Number*/ IS NULL THEN 1
WHEN ColumnName <= :ValueTo/*Number*/ THEN 1
ELSE NULL END
)
@k-maru
k-maru / grunt-filesize.js
Created January 9, 2015 05:00
grunt-filesizeの設定イメージ
filesize: {
options: {
optput: [
{
stdout: true, //default false
format: "{fullname} {relname} {filename} {byte:'0.0':green} {'byte'::green}, {kbyte} kb, {mbyte} mb"
},
{
path: "reports/filesize/filesize.csv",
overwrite: true, //default false
@k-maru
k-maru / Gruntfile.task.js
Last active August 29, 2015 14:11
Grunt glob expand
grunt.registerTask("checkglob", "check glob expanded filed", function(){
var config = grunt.config,
target = grunt.option("target") + "",
props = target.split("."),
value = config.data;
props.forEach(function(prop){
if(typeof value === "undefined"){
return;
}
@k-maru
k-maru / SampleController.cs
Last active August 29, 2015 14:06
Microsoft.AspNet.WebApi.OData Setting
//using に追加
using System.Web.Http.OData;
using System.Web.Http.OData.Query;
namespace Sample.Controllers {
public class SampleController: ApiController {
//属性付加
[EnableQuery]
public IQueryable<User> Get(){
@k-maru
k-maru / format.cs
Last active April 16, 2024 00:47
T-SQL Format C# Code
class Program {
static void Main(string[] args) {
var query = "select A.ID, A.NAME from (select ID, NAME from BAR) A where A.ID = '1'";
var parser = new TSql120Parser(false);
IList<ParseError> errors;
var parsedQuery = parser.Parse(new StringReader(query), out errors);
if (errors.Count > 0) {
foreach (var err in errors) {
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(err.Message);
@k-maru
k-maru / getTypeScriptVersion.ts
Created May 9, 2014 12:38
Node TypeScript Loader
import _vm = require("vm");
import _path = require("path");
import _fs = require("fs");
function getTypeScriptVersion(): string {
var typeScriptDir = _path.dirname(require.resolve("typescript")),
packageJsonPath = _path.resolve(typeScriptDir, "..", "package.json");
if (!_fs.existsSync(packageJsonPath)) {
throw new Error("TypeScript not found.")
@k-maru
k-maru / bootstrap-plugin-base.js
Last active August 29, 2015 13:55
Bootstrap Plugin Base
//change "Plugin"
function Plugin(element, options){
this._element = element;
this._options = options;
}
//change "Plugin"
Plugin.nullValue = {};
//change "pluginName"
@k-maru
k-maru / reset.css
Created January 9, 2014 12:18
reset css for html5
html, body, body div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, figure, footer, header, hgroup, menu, nav, section, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
outline: 0;
vertical-align: baseline;
background: transparent;
color: #444444; /**/
}
@k-maru
k-maru / reset.css
Created January 9, 2014 12:17
reset css for html4
html {
font-size: 75%;
}
body {
font-family: sans-serif; /**/
overflow: hidden;
-moz-user-select: -moz-none;
-ms-user-select: none;
-webkit-user-select: none;
@k-maru
k-maru / json_loose.js
Created January 9, 2014 12:16
json loose parser
if(!JSON){
JSON = {};
}
(function(global, undef){
"use strict";
var ch,
pos = 0,
text,