Skip to content

Instantly share code, notes, and snippets.

View csharpforevermore's full-sized avatar
💭
Developing

Randle csharpforevermore

💭
Developing
View GitHub Profile
@csharpforevermore
csharpforevermore / AuthoHotKeyList.txt
Created April 27, 2014 15:50
AutoHotKey Key List
Key Name Resulting Keystroke
{F1} - {F24} Function keys. For example: {F12} is the F12 key.
{!} !
{#} #
{+} +
{^} ^
{{} {
{}} }
{Enter} ENTER key on the main keyboard
{Escape} or {Esc} ESCAPE
@csharpforevermore
csharpforevermore / ParseToBoolean.cs
Created November 25, 2013 22:27
parse a web.config appsetting true / false to boolean.
bool isTest = Boolean.Parse(ConfigurationManager.AppSettings["appSettingValue"]);

Frontend Development

Looking for something else? Take a look at the awesome collection of other awesome lists.

// Vanilla JavaScript - trim Leading and Trailing - ES5
function TrimVanilla(str){
return str.trim();
}
// Older browsers - IE8 and before - using Polyfill. Call trim() method after running this.
function TrimPolyfill(){
if (!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^\s+|\s+$/g, '');
@csharpforevermore
csharpforevermore / Rename-Files.ps1
Created February 27, 2020 18:28 — forked from auberginehill/Rename-Files.ps1
A Windows PowerShell script for renaming files.
<#
Rename-Files.ps1
#>
# Find all wmv-files with a string "oldstring" and replace "oldstring" with "newstring" in the filename
Get-ChildItem *.wmv -Filter "*oldstring*" | ForEach { Rename-Item $_ -NewName $_.Name.Replace("oldstring","newstring") }
# Change the file extension of all .jpeg files to .jpg
@csharpforevermore
csharpforevermore / ChocoSetup.bat
Last active October 14, 2022 14:09
Chocolatey setup script for required development environment (see https://chocolatey.org/ for more information)
ECHO OFF
REM Install Chocolatey
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
REM install password manager
cinst -y dashlane
REM Install browsers
cinst -y googlechrome
cinst -y firefox
@csharpforevermore
csharpforevermore / Ideas.txt
Last active October 11, 2022 12:48
Programming Projects / Coding Golf
* 2D games - Atari
*
Interesting projects
Pure CSS RPG (https://codepen.io/medrupaloscil/pen/arvzBG)
@csharpforevermore
csharpforevermore / commands.txt
Created September 21, 2022 14:22
Encoding mp4 videos using FFMPEG
FFMPEG is used to reduce size of videos and compress
To reduce size
• ffmpeg -i .\inputvideo.mp4 -vcodec libx265 -crf 28 outputvideo.mp4
To compress audio
• ffmpeg -i .\2.mp4 -filter_complex "[0]dynaudnorm[a]" -map 0:v -map "[a]" -map 0:a -c:v copy -c:a:1 copy 3.mp4
@csharpforevermore
csharpforevermore / JsonConvertExtension.cs
Last active March 29, 2022 21:38
Newtonsoft.Json's JsonConvert TryParse extension method - as per Stack Overflow article https://stackoverflow.com/questions/23906220/deserialize-json-in-a-tryparse-way
using Newtonsoft.Json;
public static class JsonConvertHelper
{
public static bool TryParseJson<T>(this string @this, out T result)
{
bool success = true;
var settings = new JsonSerializerSettings
{
Error = (sender, args) => { success = false; args.ErrorContext.Handled = true; },
@csharpforevermore
csharpforevermore / umbraco 7 db cleanup.sql
Last active December 15, 2021 14:02 — forked from dampee/umbraco db cleanup.sql
Umbraco Database cleanup. After pulling in an umbraco database from production, you don't need all history or log.
-- Umbraco Clear Old Document Versions To Decrease Database Size And Improve Performance
-- http://borism.net/2008/12/16/fixing-a-large-cmspropertydata-table-in-umbraco/
DECLARE @createdDate Datetime = DATEADD(m, -1, getdate())
-- dump logs
-- TRUNCATE TABLE umbracolog -- faster if log table is very big and you don't need anything
DELETE FROM umbracolog WHERE Datestamp < @createdDate
-- clean up old versions
DELETE FROM cmsPropertyData WHERE