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
1 | |
00:01:59,640 --> 00:02:02,000 | |
Там наша родина, друзья мои. | |
2 | |
00:02:06,400 --> 00:02:08,320 | |
Сквозь бури и ветер, | |
3 | |
00:02:09,760 --> 00:02:12,880 |
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
// property can have dot notation, eg 'parent.child.value' | |
export const getPropertyValue = (obj: any, property: string) => | |
property.split('.').reduce((a, b) => (a ? a[b] : undefined), obj); | |
// property can have dot notation, eg 'parent.child.value' | |
export const setPropertyValue = (obj: any, property: string, value: any) => { | |
const keys = property.split('.'); | |
const lastKey = keys.pop()!; | |
let currentObj = obj; | |
keys.forEach((key) => { |
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
import { createContext, PropsWithChildren, useContext, useState } from 'react'; | |
interface IContext { | |
getValue: <T>(key: string) => T | undefined; | |
setValue: <T>(key: string, value: T) => void; | |
} | |
const AppStateContext = createContext<IContext | undefined>(undefined); | |
const AppStateContextProvider = ({ children }: PropsWithChildren<{}>) => { |
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
; Disable "Show more options" context menu | |
[HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32] | |
@="" | |
; Disable web search from start menu | |
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Explorer] | |
"DisableSearchBoxSuggestions"=dword:00000001 |
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
void Main() | |
{ | |
var santas = new[] | |
{ | |
// TODO: Fill out names and email addresses of all participants | |
new Santa("Person 1", "person1@example.com"), | |
new Santa("Person 2", "person2@example.com"), | |
new Santa("Person 3", "person3@example.com"), | |
new Santa("Person 4", "person4@example.com"), | |
}; |
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 Get-DateTakenFromExifData { | |
param([String] $filePath) | |
try { | |
$imgData = New-Object System.Drawing.Bitmap($filePath) | |
try { | |
[Byte[]]$dateTakenExifData = $imgData.GetPropertyItem(36867).Value | |
[String]$dateString = [System.Text.Encoding]::ASCII.GetString($dateTakenExifData) | |
return [DateTime]::ParseExact($dateString, "yyyy:MM:dd HH:mm:ss`0", $null) | |
} |
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 Get-DateTakenFromExifData { | |
param([String] $filePath) | |
try { | |
$imgData = New-Object System.Drawing.Bitmap($filePath) | |
try { | |
[byte[]]$dateTakenExifData = $imgData.GetPropertyItem(36867).Value | |
[string]$dateString = [System.Text.Encoding]::ASCII.GetString($dateTakenExifData) | |
return [datetime]::ParseExact($dateString, "yyyy:MM:dd HH:mm:ss`0", $null) | |
} |
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
$files = Get-ChildItem | Sort-Object LastWriteTime | |
For ($i=0; $i -lt $files.Length; $i++) { | |
$from = $files[$i].Name | |
$to = "$($i.ToString('000')) $from" | |
Write-Host "Renaming `"$from`" to `"$to`"" | |
Rename-Item $from $to | |
} |
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 static class Base36 | |
{ | |
private const string Digits = "0123456789abcdefghijklmnopqrstuvwxyz"; | |
private const string Max = "1y2p0ij32e8e7"; | |
/// <summary> | |
/// Converts from base 10 to base 36. | |
/// </summary> | |
/// <param name="value">Value to convert</param> |
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.Text.RegularExpressions; | |
public static class EnumSnakeCaseExtensions | |
{ | |
public static string ToSnakeCase(this Enum value) | |
{ | |
return Regex.Replace(value.ToString(), @"(\p{Ll})(\p{Lu})", "$1_$2").ToLower(); | |
} |
NewerOlder