Skip to content

Instantly share code, notes, and snippets.

View MosheBerman's full-sized avatar

Moshe MosheBerman

View GitHub Profile
@MosheBerman
MosheBerman / How Not To Style UISearchBar
Created August 5, 2014 16:31
What I tried before using a solid image.
- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller
{
[self colorAllTheViews:self.searchDisplayController.searchBar.superview];
}
- (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller
{
[self fungeBackdrop];
}
<!DOCTYPE html><!--HTML5 doctype-->
<html>
<!--Rifka Rabinowitz lab2 file-->
<head>
<title> Rifka Rabinowitz CISC 1600 Lab #2 </title>
<link rel="stylesheet" href="./CSS/Rabinowitz-style.css">
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"/>
<script src='intelxdk.js'></script>
<script type="text/javascript">
@MosheBerman
MosheBerman / gist:3972164
Created October 29, 2012 07:38
Return a substring that fits a given rect
//
// NSString+MBDialogString.m
// TileParser
//
// Created by Moshe Berman on 9/23/12.
//
//
#import "NSString+MBDialogString.h"
@MosheBerman
MosheBerman / gist:3972372
Created October 29, 2012 08:31
Working text to dialog array
//
// Calculates the substring that fits in a frame
//
- (NSString *) substringThatFitsFrame:(CGRect)frame withFont:(UIFont *)font{
NSString *truncatedString = self;
CGSize clippingSize = CGSizeMake(frame.size.width, CGFLOAT_MAX);
@MosheBerman
MosheBerman / NSDate+TimeTravel.h
Created November 27, 2012 01:41
A header for an NSDate category.
#import <Foundation/Foundation.h>
@interface NSDate (timeTravel)
- (NSDate *) dateAdvancedByNumberOfDaysAgainstGregorianCalendar:(NSUInteger)numberOfDays;
- (NSDate *) dateRewoundByNumberOfDaysAgainstGregorianCalendar:(NSUInteger)numberOfDays;
- (NSDate *) dateAdvancedByNumberOfDays:(NSUInteger)numberOfDays againstCalendar:(NSCalendar *)calendar;
- (NSDate *) dateRewoundByNumberOfDays:(NSUInteger)numberOfDays againstCalendar:(NSCalendar *)calendar;
@MosheBerman
MosheBerman / Widget.cpp
Created December 3, 2012 01:59
Linked List
//
// Widget.cpp
// 3-LinkedLists
//
// Created by Moshe Berman on 12/2/12.
// Copyright (c) 2012 Moshe Berman. All rights reserved.
//
#include "Widget.h"
@MosheBerman
MosheBerman / Output 2
Created December 3, 2012 04:28
Output
Stocking 150 at $1 each.
Stocking 130 at $2 each.
(lldb) c
Process 6212 resuming
(lldb) p sales
(std::__1::vector<Sale, std::__1::allocator<Sale> > &) $0 = size=2: {
(Sale) [0] = {
(int) quantity = 0
(double) pricePerUnit = 0
}
@MosheBerman
MosheBerman / gist:5259848
Created March 28, 2013 01:52
display two spheres?
void display()
{
// Clear the previous frame
glClear(GL_COLOR_BUFFER_BIT);
{
glPushMatrix();
glTranslatef(0.5, 0.5, 0);
@MosheBerman
MosheBerman / gist:5366396
Created April 11, 2013 19:20
Animation transitions...
- (void) flipInWithCompletion:(MBTransitionCompletion)completion
{
BOOL displayingPrimary = [self isDisplayingPrimaryView];
UIView *frontView = [self frontView];
UIView *backView = [self backView];
UIView *wrapperView = [self wrapperView];
[wrapperView addSubview:frontView];
@MosheBerman
MosheBerman / gist:5385650
Created April 15, 2013 04:08
Calendar Touch handling
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
if ([[self headerView] pointInside:point withEvent:event])
{
return YES;
}
else if([[self table] pointInside:point withEvent:event])
{
return YES;