Skip to content

Instantly share code, notes, and snippets.

View csharpforevermore's full-sized avatar
💭
Developing

Randle csharpforevermore

💭
Developing
View GitHub Profile
@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
SELECT STRAIGHT_JOIN categories.id, categories.title, categories.game_count, categories.display_order FROM `categories` INNER JOIN `category_namespaces` ON `category_namespaces`.`category_id` = `categories`.`id` WHERE `categories`.`type` IN ('ClickJogos::GameCategory') AND `categories`.`published` = 1 AND (category_namespaces.namespace = 'jgo') ORDER BY
CASE
WHEN categories.id LIKE '447%' THEN 1
WHEN categories.id LIKE '448%' THEN 2
ELSE 3
END, categories.game_count DESC;
@csharpforevermore
csharpforevermore / pdconcat.py
Created June 16, 2018 15:07 — forked from phobson/pdconcat.py
funky pandas concat
import numpy
import pandas
numpy.random.seed(0)
index1 = pandas.MultiIndex.from_product(
[['A'], ['b'], ['one', 'two']],
names=['City', 'Street', 'House']
)
index2 = pandas.MultiIndex.from_product(
@csharpforevermore
csharpforevermore / join.py
Created June 16, 2018 15:03 — forked from finswimmer/join.py
Join multiple pandas dataframes
import glob
import sys
import pandas
def read_filenames(names):
for arg in names:
if "*" in arg:
for file in glob.glob(arg):
yield file
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Frontend Development

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

@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
@csharpforevermore
csharpforevermore / FormsValidationExample.cs
Last active November 26, 2015 22:13 — forked from TimGeyssens/Umbraco Forms validation example
Umbraco Forms validation example
public class FormsValidation : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
Umbraco.Forms.Web.Controllers.UmbracoFormsController.FormValidate += UmbracoFormsController_FormValidate;
}
void UmbracoFormsController_FormValidate(object sender, Umbraco.Forms.Mvc.FormValidationEventArgs e)
{
@csharpforevermore
csharpforevermore / Timer.cs
Created October 30, 2015 22:09
Stopwatch Timer
var stopwatch = Stopwatch.StartNew();
for (int i = 1; i < 1000000000; i++)
{
// run method here
}
stopwatch.Stop();
Console.writeline("Elapsed time: {0}", stopwatch.Elapsed);