Skip to content

Instantly share code, notes, and snippets.

View MosheBerman's full-sized avatar

Moshe MosheBerman

View GitHub Profile
<!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 / 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];
}
@MosheBerman
MosheBerman / ExtendedStack.java
Created November 4, 2013 22:42
The output is: [a, b, c] [a, b, c, c] Why is the output left to right? Is the insertElementAt 1-based instead of zero based?
/**
* This class extends the Stack
* so that there's a pushdown(i)
* method which copies the elements
* at index 0 and inserts it and index i.
* All items beneath index i are pushed down.
*
*/
import java.util.Stack;
/**
* This class extends the Stack
* so that there's a pushdown(i)
* method which copies the elements
* at index 0 and inserts it and index i.
* All items beneath index i are pushed down.
*
*/
import java.util.Stack;
@MosheBerman
MosheBerman / snippet.m
Created October 30, 2013 17:36
iOS 6 margins on iOS 7
- (void)applyLegacyBoundries
{
/* In iOS 7, UIKit will automatically
* put content beneath navigation bars.
* It also tries to pad scroll views
* and table views to make them
* scroll nicely beneath them.
*
* These two checks will fix them.
*
@MosheBerman
MosheBerman / Toodles.py
Last active December 18, 2015 10:09
There's a syntax error on line 30, but I have no clue what the error is. Help?
import os
import keyword
import sys
class Toodles:
def walkAndList(directory):
for dirname, dirnames, filenames in os.walk(directory):
@MosheBerman
MosheBerman / test.m
Last active December 17, 2015 20:29
A demo of the arrayDictionaryArray category pair.
// Code:
#import "ArrayDictionaryArray.h"
- (void)sampleConversion
{
NSArray *array = @[@"Hello", @"I", @"Am", @"Deep", @"Blue"];
NSDictionary *dictionary = [array dictionary];
main(int argc, char* argv[])
{
// Wire up the timer
long time = elapsedTime(0);
/* Generate a random number between MINFORKS and MAXFORKS
*/
unsigned int seed = generateSeed(0);
int n = rand_r(&seed) % MAXFORKS + MINFORKS;
/*
* Loop through the processes and wait for them
* to terminate. Then print the childid, and the
* the pid.
*/
int status = NULL;
for (int i = 0; i < n; i++)
{
@MosheBerman
MosheBerman / gist:5646116
Created May 24, 2013 19:59
Why is my second loop logging in order?
int
main(int argc, char* argv[])
{
// Wire up the timer
long time = elapsedTime(0);
/* Generate a random number between MINFORKS and MAXFORKS
*/
unsigned int seed = generateSeed(0);