Skip to content

Instantly share code, notes, and snippets.

View huobazi's full-sized avatar
🎯
Focusing

Marble Wu huobazi

🎯
Focusing
View GitHub Profile
@huobazi
huobazi / gist:1833400
Created February 15, 2012 05:03
iOS top bar loading
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
@huobazi
huobazi / gist:1875177
Created February 21, 2012 08:39
tree structure into a select drop-down.
HTML:
<select name="category_id">
<%= expand_tree_into_select_field(Category.top) %>
</select>
Ruby helper:
def expand_tree_into_select_field(categories)
returning(String.new) do |html|
categories.each do |category|
@huobazi
huobazi / gist:1875178
Created February 21, 2012 08:39
tree structure into a select drop-down.
HTML:
<select name="category_id">
<%= expand_tree_into_select_field(Category.top) %>
</select>
Ruby helper:
def expand_tree_into_select_field(categories)
returning(String.new) do |html|
categories.each do |category|
@huobazi
huobazi / 1
Created March 4, 2012 04:02
octopress/issues/466
---
layout: post
title: Scroll Page 表单提交后页面重新滚回原来滚动条所在位置
comments: true
date: 2004-09-20 13:55
categories:
- ASP.NET
- 前端开发
- Asp.net
---
@huobazi
huobazi / MyNetActivityIndicator.h
Created March 8, 2012 02:54
MyNetActivityIndicator
//
// MyNetActivityIndicator.h
//
//
// Created by Marble Wu on 12-3-8.
// Copyright (c) 2012年. All rights reserved.
//
#import <Foundation/Foundation.h>
@huobazi
huobazi / gist:2202312
Created March 26, 2012 02:14
SQLSERVER 表 数据字典导出
--
--在设计表时将字段的Description加上
--然后执行下面的SQL就可以了
--
DECLARE @table_name NVARCHAR(1000)
SET @table_name = 'LuckDrawActivities'
SELECT '' AS [Key],
sys.columns.name AS 'Field Name',
sys.types.name + '(' + CONVERT ( varchar(20) ,sys.columns.max_length ) + ')' AS 'Data Type',
@huobazi
huobazi / words_count.rb
Created March 29, 2012 01:41
words count
class String
def
word_count
frequencies = Hash.new(0)
downcase.scan(/\w+/) { | word | frequencies[word] += 1}
return frequencies
end
end
@huobazi
huobazi / IEnumableExtensions.cs
Created April 18, 2012 05:01
IEnumableExtensions
public static class IEnumableExtensions
{
public static void ForEach<T>(this IEnumerable<T> value, Action<T> action)
{
foreach (var v in value)
{
action(v);
}
}
@huobazi
huobazi / Csharp_Visit_Private.cs
Created April 19, 2012 06:14
C# 反射访问私有数据
//1、得到私有字段的值:
public static T GetPrivateField<T>(this object instance, string fieldname)
{
BindingFlags flag = BindingFlags.Instance | BindingFlags.NonPublic;
Type type = instance.GetType();
FieldInfo field = type.GetField(fieldname, flag);
return (T)field.GetValue(instance);
}
//2、得到私有属性的值:
@huobazi
huobazi / gist:2657821
Created May 11, 2012 05:58
SQLServer: Length of LOB data (xxxxxxx) to be replicated exceeds configured maximum 65536
sp_configure 'max text repl size', 2147483647
Go
RECONFIGURE
GO
--Note: The setting takes effect immediately without a SQL server restart.