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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Test</title> | |
<script> | |
var obj = { | |
a: 0, | |
sayA: function () { | |
console.log("a: " + this.a); | |
} |
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
NSDateComponents *thisDayComponents = [[NSDateComponents alloc] init]; | |
[thisDayComponents setYear:2010]; | |
[thisDayComponents setMonth:9]; | |
[thisDayComponents setDay:1]; | |
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; | |
NSString *aDate = [[gregorian dateFromComponents:thisDayComponents] descriptionWithLocale:nil]; | |
NSLog(@"day:%i date:%@", [thisDayComponents day], aDate); | |
// result => day:1 date:2010-08-31 22:00:00 GMT |
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
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { | |
if([searchString length] < 1) { | |
[restaurants removeAllObjects]; | |
} | |
if ([restaurants count] < 1) { | |
[controller.searchResultsTableView setBackgroundColor:[UIColor colorWithWhite:0.0 alpha:0.8]]; | |
[controller.searchResultsTableView setRowHeight:800]; | |
} |
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
-module(ts). | |
-export([new/0, out/2, in/2]). | |
new() -> | |
spawn(fun() -> loop([], []) end). | |
loop(Tuples, Waitings) -> | |
receive | |
{out, Tuple} -> | |
NewTuples = [Tuple | Tuples], |
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
<p>Username:<br /> | |
<h:inputText id="username" | |
value="#{AccountController.account.userName}" | |
required="true" | |
requiredMessage="A name is required." | |
maxlength="25"> | |
<f:ajax event="keyup" render="availability" listener="#{AccountController.availabilityListener}" /> | |
</h:inputText> | |
<h:outputText id="availability" value="#{AccountController.availability}" /> | |
</p> |
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
final class HttpRequest implements Runnable | |
{ | |
// Constants | |
final static String HTTP_VERSION = "HTTP/1.0"; | |
final static String CRLF = "\r\n"; | |
final static class HttpResponse | |
{ | |
final static String OK = HTTP_VERSION + " 200 OK " + CRLF; | |
final static String NOT_FOUND = HTTP_VERSION + " 404 Not Found " + CRLF; |
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
(@@) :: Parser (a->b) -> Parser a -> Parser b | |
(p @@ q) s = | |
[(f x,s'') | (f,s') <- p s, | |
(x,s'') <- q s'] |
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
int x = 0; | |
int f() { | |
print x; | |
} | |
int g() { | |
int x = 2; | |
print x; | |
} |
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
$x = 0; | |
sub f { | |
print $x; | |
} | |
sub g { | |
print $x; | |
my $x = 2; # if instead local here then it prints 11221 | |
print $::x; |
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
NSDate *date = [self.bookingController.bookingData objectForKey:@"date"]; | |
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; | |
NSDateComponents *components = [[NSDateComponents alloc] init]; | |
[components setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]]; | |
components.month = -1; | |
NSDate *nextMonth = [gregorian dateByAddingComponents:components toDate:date options:0]; | |
[components release]; | |