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
# First version | |
def fizzbuzz num | |
answer = [] | |
answer.push 'fizz' if num % 3 == 0 | |
answer.push 'buzz' if num % 5 == 0 | |
answer.push num if num % 3 != 0 and num % 5 != 0 | |
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
Feature: User accounts | |
Scenario: A user can log in to the site | |
Given: I am on the log in page | |
When: I fill in user details | |
And: click "Sign in" | |
Then: I should be redirected to the "my account" page |
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
C:\Windows\System32\WindowsPowerShell\v1.0 | |
ModuleType Name ExportedCommands | |
---------- ---- ---------------- | |
Manifest AppLocker {} | |
Manifest BitsTransfer {} | |
Manifest PSDiagnostics {} | |
Manifest TroubleshootingPack {} | |
Manifest WebAdministration {} |
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
class ListFile | |
{ | |
static void Main(string[] args) | |
{ | |
var arg0 = args[0]; | |
try | |
{ | |
var counter = 0; | |
if (args.Length <= 0) |
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
class ExceptionThrowingExample | |
{ | |
public void DoSomething() | |
{ | |
Console.WriteLine("Starting to do something..."); | |
throw new Exception(); | |
//Will never be called. The throw command terminates the program... | |
Console.WriteLine("...finished doing something."); |
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
try | |
{ | |
// code which can cause an exception | |
} | |
catch (exception_type e) | |
{ | |
// code for handling the exception | |
} | |
finally | |
{ |
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
task BackupTestToQaDatabase { | |
try { | |
Invoke-Sqlcmd -InputFile $copySqlDatabase -ServerInstance $sqlserver -Database $databaseToBackUp -Username $databaseUsername -Password $databasePassword -QueryTimeout 240 -ErrorAction 'Stop' | |
} catch { | |
'##teamcity[buildStatus status='FAILURE' text='Build Failed']' | |
} | |
} |
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
# Option 1) remove deleted branches on fetch | |
git fetch --prune | |
# Option 2) create an alias. Open your config file... | |
git config -e | |
# ...and add the following section | |
[alias] |
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
[ | |
{ "keys": ["ctrl+shift+l"], "command": "reveal_in_side_bar"}, | |
// dependent on plugins | |
{ "keys": ["ctrl+k", "ctrl+f"], "command": "xml_prettify" } | |
] |
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 class AppCache : ICache | |
{ | |
public object GetValue(string key) | |
{ | |
MemoryCache memoryCache = MemoryCache.Default; | |
return memoryCache.Get(key); | |
} | |
public bool Add(string key, object value, DateTimeOffset absExpiration) | |
{ |
OlderNewer