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 to patch a library imported with Cocoapods | |
Forking the library, applying your patch, and pointing to your fork in the Podfile would be your best option. | |
If the library contains the podspec: | |
``` | |
pod '<library>', :git => 'https://github.com/yourname/<library>.git' | |
``` | |
If the library does not contain the podspec, you have to copy the podspec to a local path and adjust it: |
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
let fontFamilyNames = UIFont.familyNames() | |
for familyName in fontFamilyNames { | |
println("------------------------------") | |
println("Font Family Name = [\(familyName)]") | |
let names = UIFont.fontNamesForFamilyName(familyName as! String) | |
println("Font Names = [\(names)]") | |
} |
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
// Copyright (c) 2015 bysy.io. All rights reserved. | |
func recursiveFlatMap<TResult>(#root: AnyObject, | |
@noescape children: (AnyObject) -> [AnyObject]) -> [TResult] | |
{ | |
var result = [TResult]() | |
if let value = root as? TResult { | |
result.append(value) | |
} | |
result += children(root).flatMap( { recursiveFlatMap(root: $0, children: children) as [TResult] } ) |
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
// | |
// Intervals and method for testing overlapping conditions between two intervals | |
// Copyright (c) bysy.io | |
// | |
public enum IntervalOverlappingCondition | |
{ | |
Different, | |
Same, | |
Overlapping, |
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
/// <summary> | |
/// "Fast"-implementation of building HashCode | |
/// </summary> | |
public static class HashCodeBuilder | |
{ | |
internal const int Seedingprime = 42; | |
internal const int Hashingprime = 37; | |
public static int BuildHashCode(params object[] args) | |
{ |
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
/// Ruthlessly inspired by from http://kozmic.net/2014/03/22/strongly-typed-app-settings-with-castle-dictionaryadapter/ | |
public class AppSettingRequiredAttribute : Attribute | |
{ | |
} | |
public class AppSettingWrapperAttribute : DictionaryBehaviorAttribute, IDictionaryPropertyGetter, IPropertyDescriptorInitializer | |
{ | |
object IDictionaryPropertyGetter.GetPropertyValue(IDictionaryAdapter dictionaryAdapter, string key, object storedValue, PropertyDescriptor property, bool ifExists) | |
{ |
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
mongodump --host mongodb1.example.net \ | |
--db db_name \ | |
--collection collection_name \ | |
--query '{ _id: { $gte: ObjectId("537c3ca7cfefc541c4a41a8e") } }' \ | |
--out /tmp/mongodump | |
bsondump tmp/mongodump/Historic.bson/db_name/mongodump.bson |
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
/// <summary> | |
/// Fix of JsonMediaTypeFormatter that does not convert JSON to object when Request is in Chunked Transfer Encoding. | |
/// </summary> | |
public class XJsonMediaTypeFormatter : JsonMediaTypeFormatter | |
{ | |
/// <summary> | |
/// Replaces web api default JsonMediaTypeFormatter with this instance. | |
/// Usage: | |
/// protected void Application_Start() | |
/// { |
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
fix by adding following line | |
------------- | |
options.exclude = options.exclude.split ',' | |
in cli.coffee | |
(Windows path: C:\Users\xxx\AppData\Roaming\npm\node_modules\jscpd\src\cli\) | |
jscpd -g csharp -o report.txt --exclude **/*.Designer.cs,**/XsdGeneratedClasses.cs |
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
// JS array equivalents to C# LINQ methods - by Dan B. | |
// Here's a simple array of "person" objects | |
var people = [ | |
{ name: "John", age: 20 }, | |
{ name: "Mary", age: 35 }, | |
{ name: "Arthur", age: 78 }, | |
{ name: "Mike", age: 27 }, | |
{ name: "Judy", age: 42 }, | |
{ name: "Tim", age: 8 } |