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
def javascript_class_type value | |
class_of = lambda { |klass| value.kind_of?(klass) } | |
case | |
when class_of.call(String) | |
return "string" | |
when class_of.call(Fixnum), class_of.call(Float) | |
return "number" | |
when class_of.call(FalseClass), class_of.call(TrueClass) | |
return "boolean" | |
when class_of.call(Array) |
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(newDoc, oldDoc, userCtx, secObj) { | |
for (var field in newDoc) { | |
if(/^_/.test(field) == false && typeof newDoc[field] == "string") { | |
if(/^(\{|\[)/.test(newDoc[field])) { | |
throw ({forbidden : field + " field doesn't contain valid JSON:\n" + newDoc[field]}); | |
} | |
} | |
} | |
} |
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
@unbound_volumes = host.configManager.datastoreSystem.QueryUnresolvedVmfsVolumes | |
fail "No unresolved VMFS volumes found" if @unbound_volumes.empty? | |
@volume = nil | |
@unbound_volumes.each do |dstore| | |
next unless dstore.is_a? RbVmomi::VIM::HostUnresolvedVmfsVolume | |
# Unless this volume matches our vmfsLabel skip it |
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
my $datastoreSystem = Vim::get_view(mo_ref => $host->configManager->datastoreSystem); | |
my @unbound = $datastoreSystem->QueryUnresolvedVmfsVolumes(); | |
foreach my $dstore (@unbound) { | |
my $volume = ${$dstore}[0]; | |
if($volume->{'vmfsLabel'} ne $vmfsLabel) { | |
print "Unresolved VMFS volume ".$volume->{'vmfsLabel'}." found but does not match ".$vmfsLabel."\n"; | |
next; | |
} | |
my @extpaths; |
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
perl -e 'use strict; my %a; my $a; $a{"1"} = 0; $a = 1; print "$a{$a}\n$a\n";' |
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
unset $LOCKED | |
LOCKFILE="/tmp/lockfile" | |
function waitlock | |
{ | |
while [ -d "$LOCKFILE" ]; do | |
sleep 10 | |
done | |
} | |
function lock |
NewerOlder