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
//current date | |
NSDate* date = [NSDate date]; | |
//conversion to unix representation | |
NSTimeInterval time = [date timeIntervalSince1970]; | |
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
[UIView animateWithDuration:0.3 animations:^() { | |
self.commentContentLabel.alpha = (editing)? 0.0 : 1.0; | |
}]; | |
//////////////// | |
[UIView beginAnimations:nil context:nil]; | |
[UIView setAnimationDuration:1.0]; | |
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.commentContentLabel cache:YES]; | |
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
CABasicAnimation *theAnimation; | |
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"]; | |
theAnimation.duration=1; | |
theAnimation.repeatCount=2; | |
theAnimation.autoreverses=YES; | |
theAnimation.fromValue=[NSNumber numberWithFloat:0]; | |
theAnimation.toValue=[NSNumber numberWithFloat:-60]; | |
[view.layer addAnimation:theAnimation forKey:@"animateLayer"]; |
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 void CreateExpression() | |
{ | |
Type argType = typeof (MyClass); | |
string propertyName = "Name"; | |
ParameterExpression paramExpression = Expression.Parameter(argType, "item"); | |
//Create "item.Name" and "item.GetType()" expressions | |
var propertyAccessExpression = Expression.Property(paramExpression, propertyName); | |
var getTypeExpression = Expression.Call(paramExpression, "GetType", Type.EmptyTypes); |
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
PREFIX="SVC-41+2: " | |
ORIG_MSG_FILE="$1" | |
T="/tmp/git-temp-commit-msg" | |
(printf "%s" "$PREFIX"; cat "$ORIG_MSG_FILE") > "$T" | |
cat "$T" > "$ORIG_MSG_FILE" |
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
[NUnit.Framework.TestAttribute] | |
public void $TestMethodName$() | |
{ | |
$END$ | |
} |
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
// https://dotnetfiddle.net/INhbdg | |
public static class EnumerableEx | |
{ | |
public static IEnumerable<TReturn> ZipAll<T1, T2, TReturn>( | |
this IEnumerable<T1> first, | |
IEnumerable<T2> second, | |
Func<T1, T2, TReturn> f, | |
T1 seed1, | |
T2 seed2) |
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
/** | |
* Using Interactive Extensions Async / Ix-Async | |
* https://www.nuget.org/packages/Ix-Async/ | |
* https://github.com/Reactive-Extensions/Rx.NET | |
*/ | |
var tasks = Enumerable.Range(0, 10).Select(i => Task.Run(() => | |
{ | |
Debug.WriteLine("evaluating " + i); |
OlderNewer