Skip to content

Instantly share code, notes, and snippets.

View mika76's full-sized avatar
🤖
Coding...

Mladen Mihajlović mika76

🤖
Coding...
  • Serbia
  • 13:10 (UTC +02:00)
View GitHub Profile
@mika76
mika76 / del.ps1
Created November 18, 2024 10:43
TFS Delete Workspaces owner by user
# Tries to match everything until the owner field as the workspace name (thanks redgate sql source control)
tf workspaces /owner:domain\username|
Select-Object -Skip 2 |
ForEach-Object {
if ($_ -match "^(.*?)Username") {
$workspace = $Matches[1].Trim()
Write-Host "Will delete workspace: $workspace"
tf workspace /delete "$workspace;domain\username" /noprompt
}
@mika76
mika76 / Microsoft.PowerShell_profile.ps1
Last active July 11, 2023 10:21
C:\Users\name\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
# Delete all bin and obj folders recursively
function del-obj-bin {
Param ([string]$Path = ".\")
$title = 'Delete all nested obj and bin folders'
$question = 'Are you sure you want to proceed?'
$choices = '&Yes', '&No'
$decision = $Host.UI.PromptForChoice($title, $question, $choices, 1)
@mika76
mika76 / useEmptySlotCheck.js
Created May 6, 2023 11:44 — forked from marina-mosti/useEmptySlotCheck.js
Vue 3 check for slot with no content
import { computed, Comment, Fragment, Text } from 'vue'
/**
* Determines whether a slot is empty for Vue 3: https://github.com/vuejs/vue-next/issues/3056
* @param {Function} slot - The slot $slot.name
* @returns {Boolean}
*/
// Adapted from https://github.com/vuejs/vue-next/blob/ca17162e377e0a0bf3fae9d92d0fdcb32084a9fe/packages/runtime-core/src/helpers/renderSlot.ts#L77
@mika76
mika76 / ChatGPT.ps1
Last active March 30, 2023 07:01
Powershell chat gpt cmdlet
function Invoke-ChatGPT {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, Position = 0)]
[string]$Prompt,
[Parameter(Mandatory = $false)]
[int]$MaxTokens = 50
)
@mika76
mika76 / useHasSlot.js
Created January 25, 2023 13:43 — forked from rhysburnie/useHasSlot.js
vue3 determine if slot is being used (has content)
import { useSlots } from 'vue';
export default function useHasSlot() {
const slots = useSlots();
return function hasSlot(name) {
return slots[name] && !isEmptySlot(slots[name]());
};
}
function isEmptySlot(items) {
@mika76
mika76 / verlet.p8
Last active January 16, 2023 12:28
Pico-8 verlet integration rope - using https://www.youtube.com/watch?v=3HjO_RGIjCU
pico-8 cartridge // http://www.pico-8.com
version 39
__lua__
function _init()
mouse.init()
points = {}
sticks = {}
bounce=0.9
@mika76
mika76 / debug.lua
Created December 6, 2022 07:37
pico-8 debug function printing and formatting
--[[ pancelor printh debugging
from https://www.lexaloffle.com/bbs/?tid=42367
pq() is your swiss army knife
for debugging. use it to check
what your computer is actually
doing!
basic usage:
pq(x,y) - this is similar to
calling printh(x..y)
@mika76
mika76 / button.lua
Last active November 30, 2022 11:47
pico-8 - handling button presses without repeat
--class for tracking button pressed
--adapted from https://www.lexaloffle.com/bbs/?tid=36866
button={
init=function()
btn_new={}
btn_press={}
for i=0,5 do
btn_new[i]=false
btn_press[i]=false
end
@mika76
mika76 / mouse.lua
Last active November 30, 2022 11:21
pico-8 - Mouse class
--from https://www.lexaloffle.com/bbs/?tid=3549
mouse = {
init = function()
poke(0x5f2d, 1)
end,
-- return int:x, int:y, onscreen:bool
pos = function()
local x,y = stat(32)-1,stat(33)-1
return stat(32)-1,stat(33)-1
end,
@mika76
mika76 / Liquibase.Common.Tasks
Created November 1, 2022 19:38 — forked from mitchelldavis/Liquibase.Common.Tasks
Some MSBuild Scripts for Liquibase and MS Sql.
<?xml version="1.0" encoding="utf-8"?>
<Project InitialTargets="" DefaultTargets="All" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<AssemblyFile>$(MSBuildThisFileDirectory)\..\packages\MSBuild.Extension.Pack\tools\net40\MSBuild.ExtensionPack.TaskFactory.PowerShell.dll</AssemblyFile>
</PropertyGroup>
<UsingTask TaskFactory="PowershellTaskFactory" TaskName="CreateDatabaseTask" AssemblyFile="$(AssemblyFile)">
<ParameterGroup>
<ScriptsDirectory Required="true" ParameterType="System.String" />
<Server Required="true" ParameterType="System.String" />