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 / env.txt
Created February 24, 2017 16:06
VS2015 Cycle 9
Microsoft Visual Studio Community 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586
Installed Version: Community
Visual Basic 2015 00322-20000-00000-AA088
Microsoft Visual Basic 2015
@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(
@davidortinau
davidortinau / manifest.xml
Last active December 27, 2015 15:19
Bundle Manifest described
<?xml version="1.0" encoding="UTF-8"?>
<bundle>
<!-- (optional) describes alternate manifests for this product -->
<bundleLinks>
<link title="High Crown/Curved Bill" xmlURL="/uploads/designer/assets/products/384425_true_fitted_4_caps/384425_fitted_high_crown_curved_bill.xml" />
<link title="High Crown/Flat Bill" xmlURL="/uploads/designer/assets/products/384425_true_fitted_4_caps/384425_fitted_high_crown_flat_bill.xml" />
<link title="Medium Crown/Curved Bill" xmlURL="/uploads/designer/assets/products/384425_true_fitted_4_caps/384425_fitted_medium_crown_curved_bill.xml" />
<link title="Medium Crown/Flat Bill" xmlURL="/uploads/designer/assets/products/384425_true_fitted_4_caps/384425_fitted_medium_crown_flat_bill.xml" />
</bundleLinks>
<!-- (optional) overrides defaults for the scene -->
@davidortinau
davidortinau / Easing.cs
Created August 25, 2013 13:24
tweaked easing formula, removed params argument and default s var.
public static float EaseOutBack(float t, float start, float length)
{
float s = 1.70158f;
return length*((t=t-1)*t*((s+1)*t + s) + 1) + start;
}
var localMediaTime = CAAnimation.CurrentMediaTime();
NSObject[] keyframes = TweenBuilder.CreateKeyValues(-295, 0, Easing.EaseOutBounce);
var homeIn = new CAKeyFrameAnimation {
KeyPath = "position.x",
Duration = 1.4,
BeginTime = localMediaTime,
FillMode = CAFillMode.Forwards,
RemovedOnCompletion = false,
@davidortinau
davidortinau / ScreenResolutionUtil.cs
Created June 13, 2013 13:28
Xamarin.iOS util to measure/detect iPhone 5 screen and pull the right image from the bundle.
using System;
using System.IO;
using MonoTouch.UIKit;
namespace
{
public static class ScreenResolutionUtil
{
public static bool IsTall
@davidortinau
davidortinau / Easing.cs
Last active December 16, 2015 08:39
Xamarin.iOS Example of using a TweenBuilder w/ EasingFunction delegate, and Easing equations courtesy of https://github.com/debreuil/Swf2XNA/blob/master/V2DRuntime/Tween/Easing.cs. What might make this more useful is to perhaps make the entire CAKeyframeAnimation in the builder (factory?) and return that instead of just the key values.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace V2DRuntime.Tween
{
public delegate float EasingFormula(float t, float start, float length);
// easing equations from the ever brilliant Robert Penner
@davidortinau
davidortinau / gist:4260749
Created December 11, 2012 18:12
addEventListener Polyfill
// addEventListener polyfill 1.0 / Eirik Backer / MIT Licence
(function(win, doc){
if(win.addEventListener)return; //No need to polyfill
function docHijack(p){var old = doc[p];doc[p] = function(v){return addListen(old(v))}}
function addEvent(on, fn, self){
return (self = this).attachEvent('on' + on, function(e){
var e = e || win.event;
e.preventDefault = e.preventDefault || function(){e.returnValue = false}
e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true}