Skip to content

Instantly share code, notes, and snippets.

@ozzieperez
ozzieperez / NumericValidationTrigger.cs
Last active February 3, 2017 14:35
Xamarin.Forms Trigger Example
// Visual elements can react to events or property changes.
// Triggers can be thought of for "conditional styles".
// Types: Trigger, EventTrigger, DataTrigger, MultiTrigger
//EXAMPLE: hooking trigger to a property
//You have a trigger that fires when a property changes
//create the trigger
var trigger = new Trigger(typeof(Entry));
trigger.Property = Entry.IsFocusedProperty; // hooked to the "IsFocused" property!
@ozzieperez
ozzieperez / ISQLite.cs
Created February 14, 2015 14:38
SQLite for Xamarin.Forms Example
//db interface in shared pcl
using System;
using SQLite.Net;
namespace SampleApp
{
public interface ISQLite
{
SQLiteConnection GetConnection();
@ozzieperez
ozzieperez / IOHelper.cs
Last active March 3, 2019 19:23
Xamarin.iOS - Get Special Folder Directory
public class IOHelper
{
public enum IosSpecialFolder
{
Documents,
Library,
Cache,
Preferences,
Tmp
}
@ozzieperez
ozzieperez / ReflectionExamples.cs
Last active May 20, 2022 08:19
Reflection Examples in C#
/*
This example shows how to dynamically load assembly, how to create object instance, how to invoke method or how to get and set property value.
Create instance from assembly that is in your project References
*/
//The following examples create instances of DateTime class from the System assembly.
// create instance of class DateTime
DateTime dateTime = (DateTime)Activator.CreateInstance(typeof(DateTime));
@ozzieperez
ozzieperez / Test page for DOM Mutation Events
Created February 27, 2013 16:31
Test page to show support of DOM Mutation events
<html>
<!--
POC that detects DOM mutations on FF13+ and Chrome.
Uses MutationObserver, or DOM events as a fallback.
###################################################
For IE compatibility, replace:
myElement.addEventListener ('eventNameHere', callBackNameOrFunctionHere, false);
@ozzieperez
ozzieperez / Masonry with Flip cards and graceful degradation
Last active December 14, 2015 06:29
Masonry with gracefully degrading CSS transform flip cards. Dependencies are jQuery, Masonry, and Modernizr (only for csstransforms detection).
<html class="csstransforms3d1">
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/masonry/2.1.07/jquery.masonry.min.js"></script>
<style>
/* CARDS
*****************************************************/
.card {
/* styling */
@ozzieperez
ozzieperez / Flip Card with graceful degradation
Last active December 14, 2015 06:29
Flip Card With Graceful Degradation. Dependencies jQuery and Modernizr (can be optional). The only thing used from Modernizr is it looks for the "csstransforms3d" class to handle degradation.
<html class="csstransforms3d">
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<style>
/* CARDS
*****************************************************/
.card {
/* styling */
width: 200px;
height: 200px;