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
param( | |
[string]$server = "origin", | |
[string]$branch = "master" | |
) | |
$gitStatus = (Get-GitStatus) | |
if ($gitStatus -eq $null) { | |
write-error "Not in a Git repository." | |
} elseif ($gitStatus.HasUntracked -or $gitStatus.HasWorking -or $gitStatus.HasIndex) { |
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 tabname { | |
printf "\e]1;$1\a" | |
} | |
if [ x`type -t cd` == "xfunction" ]; then | |
# previously wrapped cd | |
eval $(type cd | grep -v 'cd is a function' | sed 's/^cd/original_cd/' | sed 's/^}/;}/' ) | |
else | |
# builtin | |
eval "original_cd() { builtin cd \$*; }" |
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
<?xml version="1.0" encoding="utf-8"?> | |
<!-- #### NOTE #### --> | |
<!-- To build with Mono's xbuild on bash, you must execute [`sudo install-nuget.sh`](https://gist.github.com/2595337) first. --> | |
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir> | |
<!-- Windows specific commands --> |
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
# in ruby, nil is an instance of NilClass. we're monkeypatching NilClass at this point, which is a bad idea for a production app. | |
# but for this example, it gets the point across and should help you find a solution to what you want... maybe... | |
class NilClass | |
def method_missing(name, *args) | |
if respond_to? name | |
return name(*args) | |
else | |
puts "do something about #{name} being nil, here" | |
# this will forward the call to the original NilClass.method_missing |
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
// How about? | |
let (|NullEmpty|NonNull|) input = | |
if System.String.IsNullOrEmpty input then NullEmpty else NonNull | |
let fullName first last = | |
match first, last with | |
| NullEmpty, NullEmpty -> failwith "Both first and last cannot be null" | |
| NonNull, NullEmpty -> first | |
| NullEmpty, NonNull -> last |
NewerOlder