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 class MyFirstProgram { | |
public static void main(String args[]) { | |
for(int i = 1; i <= 100; i++) { | |
boolean mod3 = i % 3 == 0; | |
boolean mod5 = i % 5 == 0; | |
boolean lineBreak = (i - 9) % 10 == 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
<?php | |
use Symfony\Component\ClassLoader\UniversalClassLoader; | |
$loader = new UniversalClassLoader(); | |
$loader->registerNamespaces(array( | |
'Symfony' => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'), | |
'Sensio' => __DIR__.'/../vendor/bundles', | |
'JMS' => __DIR__.'/../vendor/bundles', | |
'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib', |
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
NSView *myView = ...; | |
myView.wantsLayer = YES; // The thing you must not forget. | |
CGPoint newPosition = CGPointMake(100.0, 200.0); | |
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"]; | |
animation.fromValue = [NSValue valueWithPoint:myView.frame.origin]; | |
animation.toValue = [NSValue valueWithPoint:newPosition]; | |
animation.duration = 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
Graphics2D graphics2D = (Graphics2D)graphics; | |
graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
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
NSView *animatedView = ...; | |
CALayer *presentationLayer = (CALayer*)animatedView.layer.presentationLayer; | |
CGPoint currentPosition = presentationLayer.position; |
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
find dir -exec cat {} \; | wc -l |
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
{ | |
case 1: | |
callFirstFunction(); | |
break; | |
case 2: | |
callFirstFunction(); | |
break; | |
case 3: |
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
- (void)drawRect:(NSRect)dirtyRect | |
{ | |
NSGraphicsContext *graphicContext = [NSGraphicsContext currentContext]; | |
CGContextRef context = [graphicContext graphicsPort]; | |
// Set the origin of the coordinate system in the upper left corner instead of the lower left corner. | |
CGContextConcatCTM(context, | |
CGAffineTransformMake(1.0, 0.0, 0.0, -1.0, 0.0, self.frame.size.height)); | |
} |
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
<?php | |
$entities = array( | |
new User(1, 'John'), | |
new User(2, 'Steve'), | |
); | |
$ids = array_map(function ($entity) { | |
return $entity->getId(); | |
}, $entities); |
OlderNewer