Skip to content

Instantly share code, notes, and snippets.

View wellwind's full-sized avatar

Mike Huang wellwind

View GitHub Profile
@wellwind
wellwind / 1.draggable-modal.js
Last active March 31, 2024 08:12
Draggable Bootstrap Modal
$('.modal.draggable>.modal-dialog').draggable({
cursor: 'move',
handle: '.modal-header'
});
$('.modal.draggable>.modal-dialog>.modal-content>.modal-header').css('cursor', 'move');
@wellwind
wellwind / 1.ServerSendHubToClient.cs
Created June 11, 2015 03:56
[SignalR] 由Server主動傳訊息給Client
var context = GlobalHost.ConnectionManager.GetHubContext<THub>();
context.All.Send(message);
$(document).ready(function(){
$('.dropdown-menu').parent().on('show.bs.dropdown', function () {
var parentResponsiveTable = $(this).parents('.table-responsive');
var parentTarget = $(parentResponsiveTable).first().hasClass('table-responsive') ? $(parentResponsiveTable) : $(window);
var parentTop = $(parentResponsiveTable).first().hasClass('table-responsive') ? $(parentResponsiveTable).offset().top : 0;
var parentLeft = $(parentResponsiveTable).first().hasClass('table-responsive') ? $(parentResponsiveTable).offset().left : 0;
var dropdownMenu = $(this).children('.dropdown-menu').first();
if (!$(this).hasClass('dropdown') && !$(this).hasClass('dropup')) {
@wellwind
wellwind / README.md
Last active August 29, 2015 14:27 — forked from zenorocha/README.md
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@wellwind
wellwind / GroupPagingServiceTests.cs
Last active October 18, 2015 07:11
SkillTree TDD Homework - Day1
[TestClass]
public class GroupPagingServiceTests
{
[TestMethod]
public void GroupPagingServiceTest_驗證以3筆資料為一組時的Cost總和()
{
// 1. arrange
var pageSize = 3;
var fieldToSum = "Cost";
// 用假資料的資料來源注入
@wellwind
wellwind / 01.ApiResponseSample_Normal.js
Last active July 30, 2019 01:19
ASP.NET WebApi自訂回傳訊息Demo
{
"StatusCode": 200,
"Result": {
Name = "Wellwind",
Age = 30
},
"Error": null
}
@wellwind
wellwind / AutoMapperFromDataTableToList.cs
Created December 13, 2015 05:23
使用AutoMapper來將DataTable轉成強行別List<T>
public class MapperHelper
{
public static IList<T> GetDataFromDataTable<T>(DataSet dataSet, int dataTableIndex)
{
var table = dataSet.Tables[dataTableIndex];
using (var reader = dataSet.CreateDataReader(table))
{
return Mapper.Map<IList<T>>(reader).ToList();
}
}
@wellwind
wellwind / ClearVisualStudioComponentModelCache.bat
Created February 23, 2016 03:04
Clear Visual Studio component model cache, it's useful when visual studio crash but have no ideal how to fix.
DEL %userprofile%\AppData\Local\Microsoft\VisualStudio\10.0\ComponentModelCache
DEL %userprofile%\AppData\Local\Microsoft\VisualStudio\12.0\ComponentModelCache
DEL %userprofile%\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache
@wellwind
wellwind / todo_list.jsx
Last active August 1, 2017 07:11
[程式碼片段][React速成班]從TodoList範例學習React(2)-透過實作TodoItems學習props, 文章網址:https://dotblogs.com.tw/wellwind/2016/03/18/react-tutorial-6-props
var TodoItem = React.createClass({
render: function(){
return (<li key={this.props.key}>{this.props.children}</li>);
}
})
var TodoItems = React.createClass({
render: function() {
var displayItems = this.props.items.map(function(item) {
// return (<li key={item.id}>{item.data}</li>);
@wellwind
wellwind / todo_list.jsx
Last active April 3, 2016 02:42
[程式碼片段][React速成班]從TodoList範例學習React(3)-透過實作AddTodoForm學習state, 文章網址: https://dotblogs.com.tw/wellwind/2016/04/03/react-tutorial-7-state
var TodoItem = React.createClass({
render: function(){
return (<li key={this.props.key}>{this.props.children}</li>);
}
})
var TodoItems = React.createClass({
render: function() {
var displayItems = this.props.items.map(function(item) {
return (<TodoItem key={item.id}>{item.data}</TodoItem>);