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 / MainPage.xaml.cs
Created December 29, 2016 16:32
Xamarin Studio Project Template
using Xamarin.Forms;
namespace ${Namespace}.Views
{
public partial class MainPage : ContentPage
{
public MainPage ()
{
InitializeComponent ();
}
@davidortinau
davidortinau / SortDroidAssets.sh
Created May 5, 2016 17:20
Shell script to take Android assets exported from Sketch and sort them into resource folders. Adapted from https://medium.com/@lmindler/using-sketch-3-and-a-bit-of-fairy-dust-for-a-better-android-workflow-f667d0048855#.r8qyblpe7.
mkdir drawable-xxhdpi; mkdir drawable-xhdpi; mkdir drawable-hdpi; mkdir drawable-mdpi
for file in $(find . -type f -iname '*-xxhdpi*'); do
mv "$file" "drawable-xxhdpi/${file/-xxhdpi/}"
done
for file in $(find . -type f -iname '*-xhdpi*'); do
mv "$file" "drawable-xhdpi/${file/-xhdpi/}"
done
for file in $(find . -type f -iname '*-hdpi*'); do
mv "$file" "drawable-hdpi/${file/-hdpi/}"
done
@davidortinau
davidortinau / Zeplin.cs
Created May 3, 2016 23:00
Zeplin Style Guide for Xamarin
using System;
using UIKit;
namespace Utils
{
public static class Zeplin
{
public static UIColor TopazColor(this UIColor color)
{
return UIColor.FromRGBA(
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;
@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
// 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 / 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
@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',
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 / 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 ();