This file contains hidden or 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
This works: | |
$a = '' | |
$b = @('') | |
( $a -eq $b ) -ne ( $b -eq $a ) | |
now, the ( $a -eq $b ) is true, because $b is converted to string -> all the array members are converted to string and then concatenated by $ofs -> | |
it equals ('' -eq '') which is true | |
then ( $b -eq $a ) means (@('') -eq '') - this returns all items from array (left operand) that are equal to right operand -> it's array of '' | |
now array of '' is converted to boolean value |
This file contains hidden or 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
$game = New-Object psObject -Property @{ | |
players = @() | |
places = 0,0,0,0,0,0 | |
purses = 0,0,0,0,0,0 | |
inPenaltyBox = [bool[]](0,0,0,0,0,0) | |
popQuestions = @() | |
scienceQuestions = @() |
This file contains hidden or 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
# how should I setup $filePath so that the assert (or act) block can see it? | |
$root = split-path $MyInvocation.MyCommand.Path | |
. "$root\..\..\..\..\..\Lib\PSaint\init.ps1" | |
ipmo "$root\..\InstallerPackage.psm1" -DisableNameChecking -Force | |
$FilePath = "$root\FileList.nsi" | |
setup { | |
# or here |
This file contains hidden or 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
# how should I setup $filePath so that the assert (or act) block can see it? | |
$root = split-path $MyInvocation.MyCommand.Path | |
. "$root\..\..\..\..\..\Lib\PSaint\init.ps1" | |
ipmo "$root\..\InstallerPackage.psm1" -DisableNameChecking -Force | |
$FilePath = "$root\FileList.nsi" | |
setup { | |
# or here |
This file contains hidden or 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
## samples: | |
#1. copy this gist to clipboard (via CTRL+C); the following script will filter only rows that contain 'function' a copy them back to clipboard | |
(clip -AsLines) -match 'deleted' | clip | |
# I use it quite often when looking for some info in log files | |
#2. Quite useful when working with conversion functions. Let's define conversion to base64. | |
function ToBase64($str) { | |
[system.convert]::ToBase64String([system.text.encoding]::utf8.getBytes($str)) | |
} | |
# then just copy a text to clipboard and call |
This file contains hidden or 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
PowerShell guys, | |
I answered a question on SO with this code: | |
Get-ChildItem directory | | |
Rename-Item -NewName { $_.Name -replace '^filename_+','' -replace '_+',' ' } | |
Zdan asked me where in the documentation could be found that -NewName accepts scriptblock as a parameter. | |
Is there anything in the doc about that? | |
Thx for your answers (here, on Twitter, or even on SO) :) |
This file contains hidden or 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
<a href="#" class="delete" title="Delete - Deletes the item from the system. This will cancel all bla bla bla." | |
onclick=" | |
var checked = true; | |
var checkUrl = '/cm/Product/294912/CheckDelete'; | |
var data = { | |
__RequestVerificationToken : 'fI0pfQC+Ma7GEnqio5q1......', | |
id: 819200, | |
returnUrl: '......' | |
} | |
This file contains hidden or 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
$r = [regex]'contentBox=(?<url>http://www.fatrafloor.cz/uploads/thumbnails/thumbnail-800600[^"]*)"' | |
$d = (new-object Net.WebClient).DownloadString('http://www.fatrafloor.cz/cz/thermofix/kolekce-drevo/') | |
$r.Matches($d) | | |
% { $_.Groups["url"].Value } | | |
% { Start-Process $_ } |
This file contains hidden or 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 switchtest { | |
param([switch]$myswitch) | |
if ($myswitch) { 'switch is on' } | |
if (!$myswitch) { 'switch if off' } | |
#same as above | |
#if ($myswitch) { 'switch is on' } else { 'switch if off' } | |
write-host switch value is ([bool]$myswitch) and $myswitch | |
} |
This file contains hidden or 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
alenkacz konečně někdo, kdo mi vysvětlil, proč bych měla aspoň uvažovat o Ruby nebo Pythonu http://goo.gl/EzRth via @denisalorencova | |
AugiCZ @alenkacz Btw. všechny ty filtrace a další věci okolo FCF jdou stejně elegantně (spíš ještě líp - např. překlad do SQL) dělat v C# - LINQ :) | |
alenkacz @AugiCZ ze je C# bestovni vim uz dlouho! ale napsal to pekne :) to ze ve srovnani s javou by asi vyhralo vse (az na perl a phpko) tusim :) | |
VykrikyDoTmy @alenkacz C#? Myslíš tu odpornost navrhovanou způsobem "každý týden alespoň jedna nová syntaktická konstrukce"? ;) | |
alesroubicek @VykrikyDoTmy @alenkacz lepší než, v týhle dekádě přidáme closure, ale nevíme jak na to. Tak snad v příští... ;) | |
VykrikyDoTmy @alesroubicek @alenkacz "hlavně to neuspěchat, abychom to nepos... jak ty generiky před 10 lety". Opačný extrém,ale taky nic moc. | |
alesroubicek @VykrikyDoTmy @alenkacz Generyka v .net fungujou, v Javě je to jen trapnej pokus... Ano, měli ještě dekádu počkat. :) | |
NewerOlder