Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
while true; do
result=`curl -Is http://developer.apple.com/iphone/ | grep Location | grep comebacksoon`;
if [ x = "x$result" ]; then
say 'Yeah!';
exit;
fi;
sleep 30;
done;
@mtabini
mtabini / gist:602144
Created September 29, 2010 01:24
Packing algorithm #1
protected function fitImagesInClientArea():void {
// Create the main bin
var bins:Array = [new Bin(0, 0, width, height)];
// Sort the images
boxes.sort(function(a:Box, b:Box):int {
if (a.area > b.area) {
protected var binContainer:Array = [];
protected function getBinContainerAtIndex(index:int):HBox {
while (index >= binContainer.length) {
var hbox:HBox = new HBox();
hbox.percentWidth = 100;
hbox.height = 150;
addChild(hbox);
protected function fitImagesInClientArea():void {
// Create the main bin
var bins:Array = [new Bin(width, 0)];
// Sort the images
boxes.sort(function(a:Box, b:Box):int {
if (a.width > b.width) {
+ (void) queueDownloadFromURL:(NSURL *) url
withHTTPParameters:(NSDictionary *) parameters
target:(id) target
selector:(SEL) selector
atTopOfQueue:(BOOL) atTopOfQueue;
- (void) imageLoaded:(NSData *) data {
// data contains the data loaded from the web,
// or Nil in the event of an error
}
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:feeds="services.feeds.*" addedToStage="getFeed()">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
protected function getFeed():void
{
BOOL colorSimilarToColor(UIColor *left, UIColor *right) {
float tolerance = 0.05; // 5%
CGColorRef leftColor = [left CGColor];
CGColorRef rightColor = [right CGColor];
if (CGColorGetColorSpace(leftColor) != CGColorGetColorSpace(rightColor)) {
return FALSE;
}
@mtabini
mtabini / Sample.xml
Created December 12, 2010 14:01
A simple use case for a search bar.
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1056</int>
<string key="IBDocument.SystemVersion">10H574</string>
<string key="IBDocument.InterfaceBuilderVersion">823</string>
<string key="IBDocument.AppKitVersion">1038.35</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
button.red { height: 2.5em; padding: 0px 2em; padding-bottom: 2px;
color: #fff; font-size: 15px; font-family: "Lucida Grande",Helvetica,Arial,sans-serif; text-shadow: -1px -1px 0px #aaa; cursor: pointer;
background: #e22525; background: #e22525 -webkit-gradient(linear, left top, left bottom, from(#e22525), to(#e27676));
filter: progid:DXImageTransform.Microsoft.Gradient(startColorstr=#e22525, endColorstr=#e27676, gradientType=0);
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border: 2px solid #aaa; margin-left: auto; margin-right: auto; }