This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class RTest | |
| { | |
| public static int staticInt; | |
| public int instantInt; | |
| } | |
| Type type = typeof(RTest); | |
| var field = type.GetField("staticInt"); | |
| field.SetValue(null, 10); | |
| Console.WirteLine(field.GetValue(null));//why use null here? because this is a static field |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HttpClientHandler handler = new HttpClientHandler(); | |
| handler.UseDefaultCredentials = true; | |
| using(var client = new HttpClient(handler)) { | |
| var content = new FormUrlEncodedContent(new[] { | |
| new KeyValuePair<string, string>("query", "test"), | |
| new KeyValuePair<string, string>("position", "top") | |
| }); | |
| var result = client.PostAsync("http://url/", content).Result; | |
| Console.WriteLine(result.Content.ReadAsStringAsync().Result); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var request = require('request'); | |
| request.post( | |
| 'http://url/', | |
| {form: | |
| { | |
| "query" : "test", | |
| "position" : "top" | |
| } | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using (var codeProvider = new CSharpCodeProvider()) | |
| { | |
| var parameters = new CompilerParameters { GenerateExecutable = false, GenerateInMemory = true }; | |
| parameters.ReferencedAssemblies.Add("some.dll"); | |
| var results = codeProvider.CompileAssemblyFromFile(parameters, fileList); | |
| if (results.Errors.Count > 0) | |
| { | |
| var errorString = new StringBuilder(); | |
| for (int i = 0; i < results.Errors.Count; i++) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace ExtensionExample { | |
| public static class ExtensionExampleClass { | |
| public static T[] GetCustomAttributes<T>(this Type type, bool inherit) where T : Attribute { | |
| var attributes = type.GetCustomAttributes(typeof(T), inherit); | |
| return attributes as T[]; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <input type="file" id="inputFile" /> | |
| <textarea id="output"></textarea> | |
| <script> | |
| function readFile(evt) { | |
| var fs = evt.target.files; | |
| if(fs.length > 0) { | |
| var reader = new FileReader(); | |
| reader.onload = function(e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set t_Co=256 | |
| syntax on | |
| set scrolloff=3 | |
| " colorschema desert | |
| set autoindent | |
| filetype plugin indent on | |
| " no swap file | |
| set noswapfile | |
| set clipboard+=unnamed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| XNamespace xsl = "http://www.w3.org/1999/XSL/Transform"; | |
| var root = new XElement(xsl + "stylesheet", new XAttribute("version", "1.0"), new XAttribute(XNamespace.Xmlns + "xsl", xsl)); | |
| var template = new XElement(xsl + "template", new XAttribute("match", "/")); | |
| template.Add(items); | |
| root.Add(template); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """ | |
| flask.logging | |
| ~~~~~~~~~~~~~ | |
| Implements the logging support for Flask. | |
| :copyright: (c) 2014 by Armin Ronacher. | |
| :license: BSD, see LICENSE for more details. | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding=utf-8 | |
| import System.Net.Mail | |
| import httplib | |
| import time | |
| import datetime | |
| import os.path | |
| workingDir = 'E:\\IronPython-2.7.5' | |
| logFile = os.path.join(workingDir,'check.log') | |
| touchFile = os.path.join(workingDir,'touchFile') |