Used for converting an Result<Option, E> into an Option<Result<R, E>> and back.
let re = try!(regex::Regex::new(...));
let captures = re.captures().unwrap()
let parse_result = try!(captures.name("group").map(|captured| captured.parse()).flip())
#!/usr/bin/env bash | |
set -e | |
if [ -z ${XX_NOTES_PATH} ]; then | |
echo "Please set XX_NOTES_PATH environment variable" | |
exit 1 | |
fi | |
FILE_ID=$(date +%F) |
#!/usr/bin/env bash | |
DATE=( $(date +'%_H %_M %_S') ) | |
totalSec=$(( ${DATE[2]} + (${DATE[1]}*60) + (${DATE[0]}*3600) )) | |
totalDSec=$(( (1000 * totalSec) / 864 )) | |
dHrs=$(( totalDSec / 10000 )) | |
dMin=$(( (totalDSec % 10000) / 100 )) |
import java.awt.image.BufferedImage; | |
import java.io.File; | |
import java.util.Iterator; | |
import java.util.stream.IntStream; | |
import javax.imageio.ImageIO; | |
import org.odftoolkit.odfdom.type.Color; | |
import org.odftoolkit.simple.SpreadsheetDocument; | |
import org.odftoolkit.simple.table.Table; |
DECLARE SUB Pause () | |
DECLARE FUNCTION BuildingMenu! (withres!) | |
DECLARE FUNCTION CheckResources! (needed AS ANY, have AS ANY) | |
DECLARE SUB SubtractResources (a AS ANY, b AS ANY) | |
DECLARE FUNCTION Menu! (menuItems$(), length!) | |
DECLARE SUB printcoor (c AS ANY) | |
DECLARE SUB Initialize () | |
DECLARE SUB PrintPlayer (pi AS INTEGER) | |
DECLARE SUB PrintPlanet (pi!) | |
DECLARE SUB TurnBuilding (ip!, ib!) |
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char** argv) | |
{ | |
const char* wget_command = "wget ""%s"" -O ""%s"""; | |
char run_command[1000] = {0}; | |
/* | |
* File: MemoryDataStream.cpp | |
* Author: alexx | |
* | |
* Created on 24. Mai 2013, 13:15 | |
*/ | |
#include <cstring> | |
#include <cassert> | |
//#include <glog/logging.h> |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace Extensions | |
{ | |
public static class Extensions | |
{ | |
public static void Times(this int t, Action<int> f) |