Skip to content

Instantly share code, notes, and snippets.

View tiendq's full-sized avatar
🌳
Code for a Living

Tien Do tiendq

🌳
Code for a Living
View GitHub Profile
@tiendq
tiendq / NLogLogger.cs
Created July 2, 2012 03:45
Modified NLogLogger.cs from Castle.Services.Logging.NLogIntegration to include callsite information
// Copyright 2004-2010 Castle Project - http://www.castleproject.org/
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@tiendq
tiendq / getFileSize
Created August 14, 2012 10:03
Get file size of file in file input control.
// file: file input control e.g. $("#file")[0]
function getFileSize(file)
{
if (0 === file.value.length)
return 0;
// Non-IE browsers
if (file.files)
{
if (file.files.length > 0)
FOR /F "tokens=1-4 delims=/ " %%I IN ('DATE /t') DO SET CurrentDate=%%L%%J%%K
var cmd = "MSBuild";
var sourcePath = "C:\\Store.Web\\";
var profile = "Release";
var buildPath = "C:\\Build";
// Temporary folder must ends with slash.
var tempPath = buildPath + "\\Temp\\";
var outputPath = buildPath + "\\Output\\Store.zip";
@tiendq
tiendq / jquery.ui.datepicker-vi-VN.js
Created March 27, 2013 08:01
Vietnamese localization for the jQuery UI date picker plugin. Tested with jQuery UI 1.10.2
/* Vietnamese localization for the jQuery UI date picker plugin. */
/* Written by Tien Do (tiendq@gmail.com) */
jQuery(function ($)
{
$.datepicker.regional["vi-VN"] =
{
closeText: "Đóng",
prevText: "Trước",
nextText: "Sau",
@tiendq
tiendq / InlineBlock.html
Created July 31, 2013 04:10
How to fight inline blocks space and heigh 100%
<!doctype html>
<html>
<head>
<style>
.parent {
width: 600px;
box-sizing: border-box;
margin: 0;
padding: 0;
background-color: yellow;
@tiendq
tiendq / gist:45f1fd5c0d1c2d7c5fe6
Created May 29, 2014 02:20
Pixelate an image
// http://notes.ericwillis.com/2009/11/pixelate-an-image-with-csharp/
private static Bitmap Pixelate(Bitmap image, Rectangle rectangle, Int32 pixelateSize)
{
Bitmap pixelated = new System.Drawing.Bitmap(image.Width, image.Height);
// make an exact copy of the bitmap provided
using (Graphics graphics = System.Drawing.Graphics.FromImage(pixelated))
graphics.DrawImage(image, new System.Drawing.Rectangle(0, 0, image.Width, image.Height),
new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
@tiendq
tiendq / jqueryplugin.js
Created October 13, 2014 07:29
jQuery plugin example.
// Author: Tien Do
(function ($) {
$.fn.redify = function(options) {
// Extend our default options with those provided.
// Note that the first argument to extend is an empty
// object – this is to keep from overriding our "defaults" object.
var settings = $.extend({}, $.fn.redify.defaults, options);
return this.css({
@tiendq
tiendq / selectedvalue.js
Last active August 29, 2015 14:07
Get selected value/text
// I saw a sample code like this, but don't do it.
function() {
var selectId = "mySelectList";
try {
var options = document.getElementById(selectId).options;
for (var i = 0;i < options.length;i++){
if(options[i].selected) {
return options[i].value;
}
}
/* Dealing with long words in CSS
https://justmarkup.com/log/2015/07/31/dealing-with-long-words-in-css */
.hyphenate {
overflow-wrap: break-word;
word-wrap: break-word;
-webkit-hyphens: auto;
-ms-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;