Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script>
var obj = {
a: 0,
sayA: function () {
console.log("a: " + this.a);
}
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
- (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];
}
-module(ts).
-export([new/0, out/2, in/2]).
new() ->
spawn(fun() -> loop([], []) end).
loop(Tuples, Waitings) ->
receive
{out, Tuple} ->
NewTuples = [Tuple | Tuples],
<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>
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;
(@@) :: Parser (a->b) -> Parser a -> Parser b
(p @@ q) s =
[(f x,s'') | (f,s') <- p s,
(x,s'') <- q s']
int x = 0;
int f() {
print x;
}
int g() {
int x = 2;
print x;
}
$x = 0;
sub f {
print $x;
}
sub g {
print $x;
my $x = 2; # if instead local here then it prints 11221
print $::x;
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];