Skip to content

Instantly share code, notes, and snippets.

View ejknapp's full-sized avatar

Eric Knapp ejknapp

View GitHub Profile
[
{
"id" : "147",
"firstName" : "Jeff",
"lastName" : "Sager"
},
{
"id" : "121",
"firstName" : "Alan",
"lastName" : "Smith"
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%@ page language="java" contentType="application/json; charset=UTF-8" pageEncoding="UTF-8"%>[
<c:forEach var="employee" items="${jsonSearchResults.foundEmployeeList}" varStatus="status"> {
"id" : "${employee.id}",
"firstName" : "${employee.firstName}",
"lastName" : "${employee.lastName}"
}<c:choose><c:when test="${status.last}"></c:when><c:otherwise>,</c:otherwise></c:choose>
</c:forEach>]
@ejknapp
ejknapp / gist:4956877
Last active December 13, 2015 18:38
Random number between two numbers.
- (int)randomNumberFrom:(int)first to:(int)second
{
int difference = second - first;
int randomValue = arc4random() % (difference + 1);
return randomValue + first;
}
@ejknapp
ejknapp / gist:4956396
Created February 14, 2013 21:05
An Objective-C method to create a random color.
- (UIColor *)randomColor
{
CGFloat red = ((arc4random() % 100) / 100.0);
CGFloat green = ((arc4random() % 100) / 100.0);
CGFloat blue = ((arc4random() % 100) / 100.0);
return [UIColor colorWithRed:red green:green blue:blue alpha:1.0];
}
@ejknapp
ejknapp / gist:4616057
Created January 24, 2013 00:07
A nice fancy NSLog statement.
NSLog(@"\n\tFunction\t=>\t%s\n\tLine\t\t=>\t%d", __func__, __LINE__);
@ejknapp
ejknapp / gist:4596111
Created January 22, 2013 16:37
A bookmarklet to increase the font size on a web page.
javascript:var%20p=document.getElementsByTagName('*');for(i=0;i%3Cp.length;i++)%7Bif(p%5Bi%5D.style.fontSize)%7Bvar%20s=parseInt(p%5Bi%5D.style.fontSize.replace(%22px%22,%22%22));%7Delse%7Bvar%20s=12;%7Ds+=2;p%5Bi%5D.style.fontSize=s+%22px%22%7D
@ejknapp
ejknapp / gist:4596069
Created January 22, 2013 16:31
A bookmarklet that will reduce the font size on a web page.
javascript:var%20p=document.getElementsByTagName('*');for(i=0;i%3Cp.length;i++)%7Bif(p%5Bi%5D.style.fontSize)%7Bvar%20s=parseInt(p%5Bi%5D.style.fontSize.replace(%22px%22,%22%22));%7Delse%7Bvar%20s=12;%7Ds-=2;p%5Bi%5D.style.fontSize=s+%22px%22%7D
@ejknapp
ejknapp / gist:4580156
Created January 20, 2013 17:41
Enable zooming in mobile browsers.
javascript:document.querySelector('meta[name=viewport]').setAttribute('content','width=device-width,initial-scale=1.0,maximum-scale=10.0,user-scalable=1');
#import "Contact.h"
@interface Contact ()
@property (strong) NSString *firstName;
@property (strong) NSString *lastName;
@property (strong) NSString *email;
@property (strong) NSString *cell;
#import <Foundation/Foundation.h>
@interface Contact : NSObject
- (id)initWithJSONDictionary:(NSDictionary *)jsonDictionary;
- (NSString *)fullName;
- (NSDictionary *)jsonDictionary;
@end