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 / WebViewTap_partial.cs
Created February 25, 2014 15:48
UITapGestureRecognizer with UIWebView
// In your ViewDidLoad setup
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// ... other setup
var tapRecognizer = new UITapGestureRecognizer (this, new Selector ("HandleTapFrom"));
tapRecognizer.NumberOfTapsRequired = 1;
tapRecognizer.Delegate = new GestureDelegate ();
SomeView = Backbone.View.extend
viewMethod: ->
# do something in the view, can be called @viewMethod() or from outside like someView.viewMethod()
otherMethod = () ->
# whaddya call this?
otherOtherMethod = () ->
# whaddya call this?
@davidortinau
davidortinau / Gruntfile.js
Created September 8, 2014 22:15
imperial grunt and compass
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: { // Task
dist: { // Target
options: { // Target options
sassDir: 'source/sass',
cssDir: 'css',
@davidortinau
davidortinau / Dictionary.swift
Created December 16, 2014 22:07
NSDictionary Obj-C to Swift
// attempt to recreate the dictionary in Swift
var style:[String:NSDictionary] = [
"$default" : [NSFontAttributeName : UIFont(name: "Raleway", size: 12)],
"strong" : [NSFontAttributeName : UIFont(name: "Raleway-Bold", size: 12)],
"h1" : [NSFontAttributeName : UIFont(name: "Raleway-Bold", size: 14)]
]
// use as an NSDictionary fails at runtime
style._bridgeToObjectiveC() as NSMutableDictionary
// Playground - noun: a place where people can play
import UIKit
var occupations = Dictionary<String, Any?>()
occupations["one"] = 1
occupations["two"] = "two"
println(countElements(occupations))
@davidortinau
davidortinau / animationBlock.cs
Created February 17, 2015 18:36
Xamarin iOS Animation
UIView.Animate(.2, 0, UIViewAnimationOptions.Autoreverse | UIViewAnimationOptions.CurveEaseInOut, () =>
{
Center = new CGPoint(Origin.X + 20, Origin.Y);
}, () =>
{
Center = Origin;
});
// OR
using System;
using Cirrious.MvvmCross.Binding.BindingContext;
using Cirrious.MvvmCross.Binding.Touch.Views;
using UIKit;
using Foundation;
using DirecTV.iPad.Utils;
using Cirrious.MvvmCross.ViewModels;
using CoreGraphics;
using DirecTV.Core.Models;
using System.Collections.ObjectModel;
package {
import reflex.containers.Application;
import reflex.behaviors.TouchScrollBehavior;
import reflex.components.Scroller;
import flash.display.Bitmap;
import flash.display.MovieClip;
/**
* @author David Ortinau <dave@davidortinau.com>
@davidortinau
davidortinau / TextArea in Scroller
Created November 25, 2010 00:07
scroller content with TextArea. TextArea touch can scroll the Scroller and not steal focus.
<s:Scroller width="100%" height="100%">
<s:VGroup width="100%" paddingTop="20" paddingLeft="20" paddingRight="20" paddingBottom="20" gap="20">
<s:Group width="100%">
<s:Rect width="100%" height="100%" radiusX="8" radiusY="8">
<s:fill>
<s:SolidColor color="#F1F0E6"/>
</s:fill>
</s:Rect>
<s:VGroup width="100%" paddingTop="20" paddingLeft="20" paddingRight="20" paddingBottom="20" gap="20">
@davidortinau
davidortinau / TextAreaHackaroundHome.mxml
Created November 25, 2010 03:21
Hero TextArea hack to detect tap vs scroll and set focus manually on TextArea
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
creationComplete="view1_creationCompleteHandler(event)"
title="TextArea Workaround">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
[Bindable]