Skip to content

Instantly share code, notes, and snippets.

View davidortinau's full-sized avatar
📱
making something amazing

David Ortinau davidortinau

📱
making something amazing
View GitHub Profile
@davidortinau
davidortinau / gist:770977
Created January 8, 2011 16:45
Dismiss the keyboard when the user clicks Search while using UISearchBar
- (void)viewDidLoad {
{
UIView * subView;
NSArray * subViews = [mySearchBar subviews];
// loop through search bar pieces to get to the text field so you can
// set the delegate and then resign first responder on it
for(subView in subViews)
{
if( [subView isKindOfClass:[UITextField class]] )
@davidortinau
davidortinau / gist:789047
Created January 21, 2011 00:49
LoaderMax Lazy Loading Strategy
// What I usually do is have an XML manifest that lists all of my assets as loaders for LoaderMax to handle
// For example:
<?xml version="1.0"?>
<config idletime="90000" launchPosition="right" webServiceURL="" scaleFactor="1">
<XMLLoader name="en" url="/assets/xml/content_en.xml" load="true" />
<XMLLoader name="es" url="/assets/xml/content_es.xml" load="false" />
<XMLLoader name="zh" url="/assets/xml/content_cn.xml" load="false" />
</config>
@davidortinau
davidortinau / gist:794524
Created January 25, 2011 04:44
My Rails3 Routing Issue - params are empty
# this is my route
match 'papers/:url_title' => 'papers#show', :as => :permalinkpaper
# this is the url being called
http://localhost:3000/papers/great-passion
# which properly matches to this controller#action for papers#show
def show
@paper = Paper.where(:url_title => params[:url_title]).first()
PaperHistory.add( current_user, @paper.id )
@davidortinau
davidortinau / gist:800303
Created January 28, 2011 14:18
AIR for Android Manfiest granting INTERNET permissions
<android>
<manifestAdditions>
<![CDATA[
<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-configuration android:reqFiveWayNav="true"/>
<supports-screens android:normalScreens="true"/>
<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
<application android:enabled="true">
@davidortinau
davidortinau / gist:954462
Created May 3, 2011 23:31
Flex Embedded Font CSS
/* CSS file */
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
@font-face {
src: url("assets/fonts/HelveticaNeueLTStd-Bd.otf");
fontFamily: HelveticaNeueBold;
fontStyle: normal;
fontWeight: bold;
embedAsCFF:true;
@davidortinau
davidortinau / gist:954793
Created May 4, 2011 05:20
Spark Label with embedded font
<s:Label text="HelveticaNeueBold"
textAlign="left"
fontSize="12"
fontFamily="HelveticaNeueBold"
fontLookup="embeddedCFF"
color="#5d5c62"
>
<s:filters>
<s:DropShadowFilter blurX="0" blurY="0" distance="1" hideObject="false" color="#ffffff"
inner="false" strength="1" alpha="1" quality="2" knockout="false" angle="90"/>
@davidortinau
davidortinau / gist:998990
Created May 30, 2011 14:43
AS3 AIR Application w/ Swiz and NativeWindow
package {
// imports removed for brevity
import org.swizframework.core.BeanProvider;
import org.swizframework.core.ISwiz;
import org.swizframework.core.ISwizAware;
import org.swizframework.core.Swiz;
import org.swizframework.core.SwizConfig;
[SWF(width='1080', height='1920', backgroundColor='0xFFFFFF', frameRate='30')]
<?xml version="1.0" encoding="utf-8"?>
<swiz:Swiz xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:swiz="http://swiz.swizframework.org"
xmlns:config="com.app.config.*"
xmlns:processors="com.foomonger.swizframework.processors.*">
<swiz:config>
<swiz:SwizConfig viewPackages="com.app.views.*" />
</swiz:config>
package meridiantablet.control
{
public class AlertsController
{
[SignalHandler( type="AlertsLoadRequest" )]
public function loadAlerts():void
{
// do something
}
<?xml version="1.0" encoding="utf-8"?>
<swiz:BeanProvider xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:swiz="http://swiz.swizframework.org"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:signals="com.app.signals.*">
<fx:Declarations>
<signals:AlertsLoadRequest />
<signals:AlertsLoadSuccess />