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 / 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}
@davidortinau
davidortinau / gist:4039375
Created November 8, 2012 15:11
isPepperFlashPlayer
isPepperFlashPlayer: ->
plugin = navigator.plugins['Shockwave Flash']
if plugin is undefined #IE
false
else
plugin.filename.toLowerCase().indexOf('pep') > -1
@davidortinau
davidortinau / VideComponentPartial.as
Created June 25, 2012 14:20
onVideoPlayheadUpdate handler
protected function onVideoPlayheadUpdate(event:VideoEvent):void
{
var progress:Number = videoDisplay.playheadTime / Number(videoDisplay.metadata.duration);
for (var i:int = 0; i < _actionCues.length; i++)
{
var a:ActionCueVO = ActionCueVO(_actionCues[i]);
var begin:Number = TimecodesAS3.timecodeToSeconds(a.begin);
<video id = "L1_V1" title = "LESSON 1"
file = "videos/2.f4v"
ccFilePath = "assets/xml/cc/2.dfxp.xml"
previewImagePath="assets/images/lesson1.png">
<actionCues>
<action
type="title"
title = "PATHOPHYSIOLOGY"
begin = "00:00:01.00"
end = "00:05:18.10" />
@davidortinau
davidortinau / exportSlicesJson.js
Created May 25, 2012 02:34
Writing JSON-style info to a file
try { (function() {
if (!fw.selection || !fw.selection.length) {
return;
}
var json, filePath, file;
json = '{"sprites":[';
for(i=0;i < fw.selection.length;i++){
var element = fw.selection[i];