This file contains hidden or 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 void main(String[] args) { | |
try { | |
Scanner sc = new Scanner(new File(args[0])); | |
int n = Integer.parseInt(sc.next()); | |
for (int i = 0; i < n; i++) { | |
System.out.println(sc.next()); // TEST | |
} | |
} catch (FileNotFoundException e) { |
This file contains hidden or 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
AVCaptureSession *session = [[AVCaptureSession alloc] init]; | |
AVCaptureDevice *captureDevice = [[AVCaptureDevice alloc] init]; | |
// Add input/output devices | |
// Check what media type is supported by the device | |
NSArray *devices = [AVCaptureDevice devices]; | |
for (AVCaptureDevice *device in devices) { | |
NSLog(@"Device name: %@", [device localizedName]); | |
This file contains hidden or 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
// Print out all font families | |
// Source: http://stackoverflow.com/questions/11083954/uifont-fontwithname-font-name | |
NSArray *fontFamilies = [UIFont familyNames]; | |
for (int i = 0; i < [fontFamilies count]; i++) { | |
NSLog(@"Font: %@ ...", [fontFamilies objectAtIndex:i]); | |
} |
This file contains hidden or 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
topTextField.frame = CGRect(x: rect.origin.x, y: rect.origin.y + 500, width: 500, height: 100) | |
topTextField.backgroundColor = UIColor.blueColor() | |
self.imageView.addSubview(topTextField) | |
// I just wasn't changing it enough, 10 pts is really small, apparently | |
var y: CGFloat = (rect.origin.y - 50.0) | |
// TEST - DOES THIS EVEN PUT A THING ANYWHERE (the answer was no, bc of autolayout and constraints) | |
var testTopTextField: UITextField = UITextField(frame: CGRect(x: rect.origin.x + 10, y: y, width: 300.0, height: 50.0)) | |
testTopTextField.text = "KITTENS" |
This file contains hidden or 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
if var filePath = NSBundle.mainBundle().pathForResource("movie_quote", ofType: "mp3") { | |
// Convert string to NSURL | |
var filePathURL = NSURL.fileURLWithPath(filePath) | |
} else { | |
println("File not found") | |
} |
This file contains hidden or 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
# sleep_in | |
''' | |
The parameter weekday is True if it is a weekday, | |
and the parameter vacation is True if we are on vacation. | |
We sleep in if it is not a weekday or we're on vacation. | |
Return True if we sleep in. | |
''' |
This file contains hidden or 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
int n = 3; | |
printf("(%.*s)\n", n, filepath); |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
FILE *fp; /* FILE pointer to keep track of file being accessed */ | |
int c; | |
/* If file is empty, print error message */ | |
if (fp == NULL) { |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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
// sleepIn | |
// The parameter weekday is true if it is a weekday, and the parameter vacation is true if we are on vacation. | |
// We sleep in if it * is not a weekday or we're on vacation. Return true if we sleep in. | |
public boolean sleepIn(boolean weekday, boolean vacation) { | |
if (!weekday || vacation) { | |
return true; | |
} | |
return false; | |
} |