Skip to content

Instantly share code, notes, and snippets.

Friday, 03.04.11

  • "cellspacing", "cellpadding"
  • block and inline tags
    • <p>, <h1>, <img>, <em>

Forms

  • controls, widgets
    • text fields, radio, checkbox, buttons, menus, etc.
@raheelahmad
raheelahmad / gist:1100970
Created July 23, 2011 03:40
Creating arbitrarily-colored icons from a black-with-alpha master image (iOS)
// Usage example:
// input image: http://f.cl.ly/items/3v0S3w2B3N0p3e0I082d/Image%202011.07.22%2011:29:25%20PM.png
//
// UIImage *buttonImage = [UIImage ipMaskedImageNamed:@"UIButtonBarAction.png" color:[UIColor redColor]];
// .h
@interface UIImage (IPImageUtils)
+ (UIImage *)ipMaskedImageNamed:(NSString *)name color:(UIColor *)color;
@end
@raheelahmad
raheelahmad / gist:1248645
Created September 28, 2011 17:49
Drawing MovingBalls
class MovingBall {
float x, y, w; // variables for drawing the ellipse
boolean movingForward;
boolean movingUp;
void drawItself() {
ellipse(x, y, w, w);
}
@raheelahmad
raheelahmad / gist:1248966
Created September 28, 2011 19:29
Problem 2.68
/*
* Mask with least signficant n bits set to 1
* Examples: n = 6 --> 0x2F, n = 17 --> 0x1FFFF
* Assume 1 <= n <= w
*/
int lower_one_mask(int n) {
/*
* 2ˆn-1 has bit pattern 0...01..1 (n 1’s)
* But, we must avoid a shift by 32
@raheelahmad
raheelahmad / gist:1259647
Created October 3, 2011 17:20
Circles with variable speed, size, and color
class MovingBall {
float x, y, w, maxW, speed; // variables for drawing the ellipse
boolean movingForward;
boolean movingUp;
boolean expanding;
float r, g, b;
void drawItself() {
fill(r, g, b);
@raheelahmad
raheelahmad / gist:1259699
Created October 3, 2011 17:35
Drawing boxes
class Box {
float x, y, w, h;
void drawItself() {
rect(x, y, w, h);
}
}
Box myBox;
@raheelahmad
raheelahmad / gist:1275840
Created October 10, 2011 17:18
Circle Drawer
class CircleDraw {
float x, y, r, a;
void drawSelf() {
fill(255);
noStroke();
ellipse(x + r * cos(a), y - r * sin (a), 5, 5);
a += 0.1;
if (a >= 2 * PI) {
@raheelahmad
raheelahmad / gist:1275956
Created October 10, 2011 17:51
Veritcal Boxes
class Box {
float x, y, w, h, speed;
boolean movingForward, movingUp;
void drawItself() {
rect(x, y, w, h);
}
void update() {
if (movingForward)
@raheelahmad
raheelahmad / gist:1281971
Created October 12, 2011 17:51
Mouse Inside Ball Objects
class MovingBall {
float x, y, w, maxW, speed; // variables for drawing the ellipse
boolean movingForward;
boolean movingUp;
boolean expanding;
boolean mouseInside;
float r, g, b;
void drawItself() {
@raheelahmad
raheelahmad / gist:1299069
Created October 19, 2011 17:42
Midterm Exam
class LineDrawer {
float x1, y1, x2, y2;
boolean movingForward;
void drawItself() {
line (x1, y1, x2, y2);
}
void update() {
if (movingForward) {