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
Dim bytes As New Byte() { CByte(131) } | |
Dim str As String = Encoding.GetEncoding(1252).GetString(bytes) | |
' Or, much simpler: | |
Dim str As String = ChrW(&H0192).ToString() |
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
' Single-line lambdas: | |
_myService.MyMethod(userId, profileId, | |
Sub(message As EventArgs) _eventAggregator.SendMessage(message)) | |
' Multi-line lambdas: align `Sub` and `End Sub`: | |
_myService.MyMethod(userId, profileId, Sub(message As EventArgs) | |
_eventAggregator.SendMessage(message) | |
_localVariable = e.Result |
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
#!/usr/bin/env bash | |
source ~/.config/extpaths # For samtools | |
set -e | |
set -u | |
n=0 | |
for bam in $*; do |
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
result = x == "foo" ? foo() : | |
x == "bar" ? bar() : | |
x == "baz" ? baz() : | |
x == "qux" ? qux(); |
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
while (getline(in, line)) { | |
if (line.compare(0, 4, "@RG\t") != 0) continue; | |
size_t start = line.find("\tID:"); | |
if (start == string::npos) continue; | |
start += 4; | |
size_t end = line.find("\t", start); | |
if (end == string::npos or end == start) continue; | |
gids.emplace(string.begin() + start, string.begin() + end); | |
// Or, in C++03: | |
//gids.insert(line.substr(start, end - start)); |
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
#!/usr/bin/env bash | |
set -e | |
set -u | |
input="${1-/dev/stdin}" | |
declare -A counts=( | |
[A]=0 | |
[C]=0 |
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
enum class dna_strand : char { | |
positive = '+', | |
negative = '-' | |
}; | |
std::ostream& operator <<(std::ostream& out, dna_strand strand) { | |
return out << static_cast<char>(strand); | |
} | |
std::istream& operator >>(std::istream& in, dna_strand& strand) { |
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
using System; | |
using System.Collections.Generic; | |
namespace klmr { | |
// Version from http://stackoverflow.com/a/75502/1968 | |
public class Test { | |
public static bool IsAssignableToGenericType(Type givenType, Type genericType) { | |
var interfaceTypes = givenType.GetInterfaces(); | |
foreach (var it in interfaceTypes) |
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
#include <algorithm> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <boost/container/vector.hpp> | |
struct TrieNode { | |
boost::container::vector<TrieNode> children; | |
std::vector<std::vector<std::string>::const_iterator> head; |
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
#ifndef TEXT_STRING_HPP | |
#define TEXT_STRING_HPP | |
#include <algorithm> | |
#include <cstring> | |
#include <iterator> | |
#include <memory> | |
#include <iosfwd> | |
namespace text { |