Skip to content

Instantly share code, notes, and snippets.

View windwp's full-sized avatar
💭
I may be slow to respond.

windwp

💭
I may be slow to respond.
  • VietNam
View GitHub Profile
@windwp
windwp / Form sniplet
Last active August 29, 2015 14:06
Form sniplet
public void LogText(string message)
{
log_rtb.Invoke(((MethodInvoker)delegate
{
log_rtb.AppendText(String.Format("-{0}: \r\n", message));
}));
}
protected void ClearText()
@windwp
windwp / skill form them
Last active August 29, 2015 14:06
skill form them
https://skill.codeplex.com/
inurl:ftp -inurl:http -inurl:https .css
{
"name": "",
"version": "1.0.0",
"authors": [
"Flatfull"
],
"description": "",
"keywords": [
"AngularJS",
"admin",
@windwp
windwp / wpf binding
Created May 15, 2015 12:56
wpf binding
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=ContextMenu}, Path=PlacementTarget.SelectedItem}"
@windwp
windwp / SubStringForLinqPad.cs
Created October 22, 2015 08:33
substring linqpath
void Main()
{
var url="http://google.com";
var startPos=url.IndexOf("chuong-")+7;
startPos.Dump();
var endPos=url.IndexOf("-",url.IndexOf("chuong-")+7)-startPos;
endPos.Dump();
var result=url.Substring(startPos,endPos);
result.Dump();
@windwp
windwp / Xpath collection
Last active November 2, 2015 10:16
xpath
xpath no child
//*[count(*)=0]
xpath attribute
/div[@class='td_block_inner']
@windwp
windwp / Seriazile and Deserialize.cs
Last active November 2, 2015 10:19
C# useful function
/// <summary>Serializes the specified object as a JSON string</summary>
/// <param name="objectToSerialize">Specified object to serialize</param>
/// <returns>JSON string of serialzied object</returns>
private static string Serialize(object objectToSerialize)
{
using (System.IO.MemoryStream _Stream = new System.IO.MemoryStream())
{
try
{
var _Serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(objectToSerialize.GetType());
@windwp
windwp / StringUtils
Last active November 27, 2015 14:37
Loại bỏ dấu tiếng việt
public class StringUtil
{
private static readonly string[] VietnameseSigns = new string[]
{
"aAeEoOuUiIdDyY",
"áàạảãâấầậẩẫăắằặẳẵ",
"ÁÀẠẢÃÂẤẦẬẨẪĂẮẰẶẲẴ",
"éèẹẻẽêếềệểễ",
"ÉÈẸẺẼÊẾỀỆỂỄ",
"óòọỏõôốồộổỗơớờợởỡ",
@windwp
windwp / datetimeFormat
Created November 27, 2015 14:54
string date time for mat for C#
// create date time 2008-03-09 16:05:07.123
DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123);
String.Format("{0:y yy yyy yyyy}", dt); // "8 08 008 2008" year
String.Format("{0:M MM MMM MMMM}", dt); // "3 03 Mar March" month
String.Format("{0:d dd ddd dddd}", dt); // "9 09 Sun Sunday" day
String.Format("{0:h hh H HH}", dt); // "4 04 16 16" hour 12/24
String.Format("{0:m mm}", dt); // "5 05" minute
String.Format("{0:s ss}", dt); // "7 07" second
String.Format("{0:f ff fff ffff}", dt); // "1 12 123 1230" sec.fraction
gulp.task('watch:replace', function () {
return gulp.watch(['./app/scripts/controllers/*.ts', 'app/scripts/math/*.ts'], ['replacefile']);
});
// noi' cac' file trong cung` 1 folder lai. de? cho dep. code :)
gulp.task('replacefile', function() {
var result = '';
var header = '';
var folders = {
'_Controller': 'app/scripts/controllers',