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 static FileStream OpenFileWithRetry(string path, FileMode mode, FileAccess fileAccess, FileShare fileShare) | |
{ | |
ArgumentsChecker.ArgumentNotNull(path, "path"); | |
var autoResetEvent = new AutoResetEvent(false); | |
while (true) | |
{ | |
try | |
{ |
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 Program | |
{ | |
static void Main(string[] args) | |
{ | |
var dict = new SmartTrackingDictionary<string, object>(); | |
dict["int"] = 1; | |
dict["int"] = 2; | |
Console.WriteLine("key 'int' {0}", dict.IsChanged("int") ? "has changed" : "hasn't changed"); | |
dict["str"] = "string1"; | |
dict["str"] = "string2"; |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import web, json, time, mpd, collections | |
STATIONS = { | |
"FoxNews" : "mmsh://209.107.209.181:80/D/138/13873/v0001/reflector:24137?MSWMExt=.asf", | |
"Classic" : "http://radio02-cn03.akadostream.ru:8100/classic128.mp3", | |
"Jazz": "http://streaming208.radionomy.com:80/A-JAZZ-FM-WEB" | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Radio RPi</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css"/> | |
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> | |
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script> | |
</head> | |
<body> |
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
static BOOL PSPDFIsDevelopmentBuild(void) { | |
#if TARGET_IPHONE_SIMULATOR | |
return YES; | |
#else | |
@autoreleasepool { | |
// There is no provisioning profile in AppStore Apps. | |
NSData *data = [NSData dataWithContentsOfFile:[NSBundle.mainBundle pathForResource:@"embedded" ofType:@"mobileprovision"]]; | |
if (data) { | |
const char *bytes = [data bytes]; | |
NSMutableString *profile = [NSMutableString new]; |
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
# xcode-build-bump.sh | |
# @desc Auto-increment the build number every time the project is run. | |
# @usage | |
# 1. Select: your Target in Xcode | |
# 2. Select: Build Phases Tab | |
# 3. Select: Add Build Phase -> Add Run Script | |
# 4. Paste code below in to new "Run Script" section | |
# 5. Drag the "Run Script" below "Link Binaries With Libraries" | |
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.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
# xcode-version-bump.sh | |
# @desc Auto-increment the version number (only) when a project is archived for export. | |
# @usage | |
# 1. Select: your Target in Xcode | |
# 2. Select: Build Phases Tab | |
# 3. Select: Add Build Phase -> Add Run Script | |
# 4. Paste code below in to new "Run Script" section | |
# 5. Check the checkbox "Run script only when installing" | |
# 6. Drag the "Run Script" below "Link Binaries With Libraries" | |
# 7. Insure your starting version number is in SemVer format (e.g. 1.0.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
//First of all you need to modify your Mapbox SDK with the this commit: | |
//https://github.com/MrZoidberg/mapbox-ios-sdk/commit/2865d642f163b15f939a906337de4f53bd17a7b6 | |
//Otherwise you will have random crashes during background rendering of maps | |
//We need semaphore to limit the number of concurrent threads | |
//Place it one per view | |
dispatch_semaphore_t _concurrencyLimitingSemaphore = dispatch_semaphore_create(3); | |
//Also we need cache to store snapshots of the map | |
NSCache *_imageCache = [NSCache new]; |
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
[Serializable] | |
public struct SmartDateTime : IFormattable, ISerializable, IXmlSerializable, IEquatable<SmartDateTime>, IConvertible | |
{ | |
private bool _current; | |
private TimeSpan _diff; | |
private DateTime _value; | |
public bool IsCurrent | |
{ | |
get { return _current; } |
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 struct Banner | |
{ | |
public int id; | |
public string url; | |
} | |
class Program | |
{ | |
private static List<Banner> _banners; |
OlderNewer