Skip to content

Instantly share code, notes, and snippets.

View greatb's full-sized avatar
🎯
Focusing

Bala Booolean greatb

🎯
Focusing
View GitHub Profile
@greatb
greatb / group.ps1
Last active March 1, 2022 01:00
PS script to group the files by created year-month
$SourceFolder = "E:\Sorce"
$outputDir = "e:\Photos-Grouped"
$files = Get-ChildItem -Path $SourceFolder -Recurse | Where-Object {$_.PSIsContainer -eq $false}
foreach ($file in get-ChildItem $files) {
$toDir = Join-Path $outputDir $file.lastwritetime.toString("yyyy\\yyyy-MM")
$toFile = Join-Path $toDir $file.name
if(!(Test-Path $toDir))
@greatb
greatb / pragram.cs
Created September 30, 2019 22:01
Console app code to rename the file by its date stamp
using System;
using System.IO;
// dotnet .\FileConsole.dll C:\Photos\Trip\2020-08-Europe Mdd
namespace FileConsole
{
class Program
{
static void Main(string[] args)
@greatb
greatb / TestExtensionMethodFailWhenTheObjectIsNull.cs
Created May 9, 2017 02:36
Test to check the Extension method behavior when the object is null
public class Company
{
public string Name { get; set; }
public Company()
{
Name = "The Name";
}
}
@greatb
greatb / cookie.service.ts
Last active April 14, 2023 17:17
Injectable CookieService class for Angular2
@greatb
greatb / C# console app example with AutoFac DI
Created November 2, 2016 00:26
C# Console app sample code for AutoFac DI and No-DI
using Autofac;
using System;
namespace AutoFacHW
{
class Program
{
static void Main(string[] args)
{
var container = ContainerConfig.Configure();
@greatb
greatb / html_minifiy.php
Last active May 9, 2017 02:38
Html Minifiy
function html_minifiy($str)
{
$str = str_replace("\t", " ", $str);
$str = str_replace(" ", " ", $str);
$str = str_replace(" ", " ", $str);
$str = str_replace(" ", " ", $str);
$str = str_replace(" ", " ", $str);
$str = str_replace("> <", "><", $str);
$str = str_replace("\n", "", $str);
$str = str_replace(" }", "}", $str);