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
package models | |
import ( | |
"time" | |
) | |
func nowFunc() time.Time { | |
return time.Now() | |
} |
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
id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:0]; | |
NSLog(@"%i", [sectionInfo numberOfObjects]); |
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)connectionDidFinishLoading:(NSURLConnection *)connection { | |
[connection release]; | |
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; | |
[responseData release]; | |
//NSLog(responseString); | |
NSError *error; | |
SBJSON *json = [[SBJSON new] autorelease]; | |
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
% Save request body to file. | |
save_data(Req, Type) -> | |
Filename = generate_filename(Req, Type), | |
Length = list_to_integer(Req:get_header_value("content-length")), | |
{ok, FileIo} = file:open(Filename, [raw, write]), | |
write_data(FileIo, Req, Length), | |
file:close(FileIo), | |
{ok, Filename}. | |
% Writes Chunked Data to 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
save_data(FileIo, Req, Length) when Length > 0 -> | |
case Length of | |
Length when Length < ?CHUNKSIZE -> | |
Chunk = Req:recv(Length); | |
_ -> | |
Chunk = Req:recv(?CHUNKSIZE) | |
end, | |
file:write(FileIo, Chunk), | |
Length1 = Length - size(Chunk), | |
save_data(FileIo, Req, Length1); |