Skip to content

Instantly share code, notes, and snippets.

background: transparent url(../images/toggle-icons-gradient.png) left bottom repeat-x;
background: -moz-linear-gradient(top, rgba(239,239,239,1) 0%, rgba(239,239,239,1) 65%, rgba(239,239,239,1) 82%, rgba(239,239,239,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(239,239,239,1)), color-stop(65%,rgba(239,239,239,1)), color-stop(82%,rgba(239,239,239,1)), color-stop(100%,rgba(239,239,239,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(239,239,239,1) 0%,rgba(239,239,239,1) 65%,rgba(239,239,239,1) 82%,rgba(239,239,239,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(239,239,239,1) 0%,rgba(239,239,239,1) 65%,rgba(239,239,239,1) 82%,rgba(239,239,239,0) 100%); /* Opera 11.10+ */
background: linear-gradient(top, rgba(239,239,239,1) 0%,rgba(239,239,239,1) 65%,rgba(239,239,239,1) 82%,rgba(239,239,239,0) 100%); /* W3C */
@birarda
birarda / gist:1495185
Created December 19, 2011 02:48
descriptionOfTopOfStack class method
+ (NSString *)descriptionOfTopOfStack:(NSMutableArray *)stack
{
// get the last object in the program stack
id topObject = [stack lastObject];
if (topObject) [stack removeLastObject];
// if this is just a number just return it
if ([topObject isKindOfClass:[NSNumber class]]) {
return [topObject description];
}
// otherwise it's an operation or variable
@birarda
birarda / gist:2578772
Created May 2, 2012 18:03
verifyRequestParameter
function verifyRequestParameter($param, $min = null, $max = null, $send_resp = true) {
// make sure the parameter was passed
if (!array_key_exists($param, $_REQUEST)) {
$error_message = "Missing {$param} parameter";
} else {
// if we have a max or min value make sure the parameter is in range
if (isset($min)) {
if ($_REQUEST[$param] < $min) {
$error_message = "Parameter {$param} not greater than accepted minimum value.";
}
@birarda
birarda / gist:2578950
Created May 2, 2012 18:25
getNearestVenuesAndUsersWithCheckinsDuringInterval
function getNearestVenuesAndUsersWithCheckinsDuringInterval() {
// verify the sw_lat, sw_lng, ne_lat, and nw_lng parameters
if (verifyRequestParameter('user_lat', -90, 90) &&
verifyRequestParameter('user_lng', -180, 180) ) {
// see if we have a checked_in_since parameter, defaults to 7 if we don't
// if the user passes a negative number just let it get set to default
$checked_in_since = verifyRequestParameter('checked_in_since', 0, null, false) ?
$_REQUEST['checked_in_since'] : NULL;
SELECT
c.id checkin_id,
u.id,
u.nickname,
u.status_text,
u.photo,
u.major_job_category,
u.minor_job_category,
l.linkedin_data AS headline,
p.filename,
@birarda
birarda / fee_calc.js
Created May 11, 2012 22:38
Eventify Fee Calculator
<script>
$("input.ticketPrice").keyup(function () {
var cut = 0.0225;
var ticketPrice = $(this).val();
var totalProfit = Number(ticketPrice) + 0;
var ticketTotal = (Number(feeTotal) + Number(ticketPrice));
if ( $('#fees').prop('checked') ) {
var ticketFee = ticketPrice * cut;
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = shadowFrame;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:1.0] CGColor],
(id)[[UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.7] CGColor],
(id)[[UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.0] CGColor],
nil];
gradient.locations = [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:0.30], [NSNumber numberWithFloat:1.0], nil];
@birarda
birarda / gist:3085075
Created July 10, 2012 17:50
XCode run script for build number as git commit SHA
#!/bin/sh
buildNumber=`/usr/bin/git rev-parse --short HEAD`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$PROJECT_NAME"/"$PROJECT_NAME"-Info.plist
@birarda
birarda / gist:3965594
Created October 27, 2012 18:27
Old CP Api setup
+ (void)sendLoveToUserWithID:(NSNumber *)recieverID
loveMessage:(NSString *)message
skillID:(NSUInteger)skillID
completion:(void (^)(NSDictionary *, NSError *))completion
{
NSMutableDictionary *reviewParams = [NSMutableDictionary dictionaryWithCapacity:2];
[reviewParams setObject:[NSString stringWithFormat:@"%@", recieverID] forKey:@"recipientID"];
[reviewParams setObject:[NSString stringWithFormat:@"%d", skillID] forKey:@"skill_id"];
[reviewParams setObject:message forKey:@"reviewText"];
@birarda
birarda / gist:3965598
Created October 27, 2012 18:29
CPapi example
+ (void)getNearestVenuesWithCheckinsToCoordinate:(CLLocationCoordinate2D)coordinate
mapQueue:(NSOperationQueue *)mapQueue
completion:(void (^)(NSDictionary *, NSError *))completion
{
// parameters for API call
// you could also send checked_in_since (timestamp) and limit (integer) to this call
// those default to 1 week ago and 25
NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setValue:[NSString stringWithFormat:@"%f", coordinate.latitude] forKey:@"lat"];
[params setValue:[NSString stringWithFormat:@"%f", coordinate.longitude] forKey:@"lng"];