Simplicity is prerequisite for reliability. --Edger Djikstra
This file contains 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
[DllImport("user32.dll")] | |
private static extern bool SetCursorPos(int X, int Y); | |
[DllImport("user32.dll")] | |
public static extern bool GetCursorPos(out Point p); | |
public static void LinearSmoothMove(Point newPosition, int steps) | |
{ | |
Point start = new Point(); | |
GetCursorPos(out start); |
This file contains 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
function getLineOfCaret(a) { | |
var b = 0; | |
if (a.selectionEnd) b = a.selectionEnd; else if (document.selection) { | |
a.focus(); | |
var c = document.selection.createRange(); | |
if (null == c) b = 0; else { | |
var d = a.createTextRange(), e = d.duplicate(); | |
d.moveToBookmark(c.getBookmark()); | |
e.setEndPoint("EndToStart", d); | |
b = e.text.length; |
This file contains 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
public App() | |
{ | |
this.Startup += this.Application_Startup; | |
this.Exit += this.Application_Exit; | |
this.UnhandledException += this.Application_UnhandledException; | |
SmartDispatcher.Initialize(Deployment.Current.Dispatcher); | |
InitializeComponent(); | |
} |
This file contains 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
$Num = 5 | |
$Jobs = @() | |
ForEach ($Job in (1..$Num)) | |
{ $Jobs += Start-Job -ScriptBlock { | |
$Count = 1 | |
Do { | |
Write-Progress -Id 2 -Activity "Background Job" -Status $Count -PercentComplete 1 | |
$Count ++ | |
Start-Sleep -Seconds 4 |
This file contains 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 System; | |
// it's required for reading/writing into the registry: | |
using Microsoft.Win32; | |
// and for the MessageBox function: | |
using System.Windows.Forms; | |
namespace Utility.ModifyRegistry | |
{ | |
public class ModifyRegistry | |
{ |
- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
- They are the people who get things done. Effective Engineers produce results.
This file contains 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 System; | |
using System.Diagnostics; | |
namespace SimplestLoggerUtility | |
{ | |
public static class Logger | |
{ | |
public static void Success(string message) | |
{ | |
EventLog.WriteEntry(AppDomain.CurrentDomain.FriendlyName, message, EventLogEntryType.Information); |
This file contains 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 System; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Text; | |
namespace CompressString | |
{ | |
internal static class StringCompressor | |
{ | |
/// <summary> |