Skip to content

Instantly share code, notes, and snippets.

View evonsdesigns's full-sized avatar
🌞

Joseph Evans evonsdesigns

🌞
View GitHub Profile
@evonsdesigns
evonsdesigns / C# Control Mouse Pointer Click.cs
Last active August 29, 2015 13:57
A C# tool for programmaticly moving the mouse and left/right clicking.
public class MouseController
{
[DllImport("User32", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, UIntPtr dwExtraInfo);
private const int MOUSEEVENTF_LEFTDOWN = 0x02;
private const int MOUSEEVENTF_LEFTUP = 0x04;
private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
private const int MOUSEEVENTF_RIGHTUP = 0x10;
@evonsdesigns
evonsdesigns / Threadsafe calls for C# WinForms, with zero parameters in method.cs
Last active August 29, 2015 13:57
Threadsafe calls for C# WinForms, with zero parameters in method
// Create the callback method
delegate Boolean checkIfMoveToUploadedFolderCallback();
// define the method to be called
private Boolean checkIfMoveToUploadedFolder()
{
// check control property InvokeRequired
if (cb_moveToUploadedFolder.InvokeRequired)
{
// create an instance of the delegate with this method's name
@evonsdesigns
evonsdesigns / Threadsafe calls to controls in C# Winforms using parameters.cs
Last active August 29, 2015 13:57
Threadsafe calls to controls in C# Winforms using parameters
delegate void updateDateTimePickerCallback(int t);
private void updateDateTimePicker(int t)
{
if (dateTimePicker1.InvokeRequired)
{
updateDateTimePickerCallback s = new updateDateTimePickerCallback(updateDateTimePicker);
this.Invoke(s, new object[] { t });
}
else
@evonsdesigns
evonsdesigns / HTML Encode Decode Textarea Javascript.js
Last active August 29, 2015 14:01
HTML Encode Decode Textarea Javascript
<button type="button" class="btn btn-default btn-xs" onclick="htmlEncode()" title="encode">HTML encode</button>
<button type="button" class="btn btn-default btn-xs" onclick="htmlDecode()" title="encode">HTML decode</button>
<br/>
<textarea id="encodedecode" cols="80" rows="10"></textarea>
<script>
function htmlEncode(){
var encoded = $("#encodedecode").val().replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
@evonsdesigns
evonsdesigns / Javascript Create Random GUID.html
Created May 20, 2014 18:55
Javascript Create Random GUID
<button type="button" class="btn btn-default btn-xs" onclick="guid()" title="generate a random guid">Generate Random Guid</button>
<br/>
<textarea id="guidtxt" cols="60"></textarea>
<script>
function guid() {
var guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16);});
$("#guidtxt").val(guid);
$("#guidtxt").select();
}
</script>
@evonsdesigns
evonsdesigns / Add _blank to all links on page.js
Created May 29, 2014 03:31
Add target="_blank" to all links on page
@evonsdesigns
evonsdesigns / Java Interview Questions
Created January 6, 2017 22:20
Java Interview Questions
1. What is the difference between '==' and .equals()?
2. Is java pass-by-value or pass-by-reference?
3. What is the difference between checked and unchecked exceptions?
4. What is an abstract class and when would you use it?
.replace(/\.?0+$/, '')
@evonsdesigns
evonsdesigns / Example.md
Last active April 16, 2018 15:24
Using jackson-datatype-hibernate5@2.9.5, spring-boot-starter@2.0.1.RELEASE, spring-boot-starter-web@2.0.1.RELEASE, spring-boot-starter-data-jpa@2.0.1.RELEASE

The following example shows how by disable the USE_TRANSIENT_ANNOTATION feature, you can include @Transient pojo fields in your serialized json responses.

Application.java

@SpringBootApplication
public class Application {

    ...

    @Bean
@evonsdesigns
evonsdesigns / test.json
Created April 19, 2018 19:54
fieldrates
{
"@type":"Job",
"notes":"Test Job for R2 Demo in TCI",
"cropYear":"2018",
"status":"COMPLETED",
"createdDate":"2018-04-02T08:59:44.957Z",
"startedDate":"2018-04-02T12:29:57.000Z",
"lastModifiedDate":"2018-04-02T12:30:55.000Z",
"type":"SEED",
"workPlan":{