This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add functionality to visual elements without subclassing. | |
//Xamarin.Form controls can have a list of Behaviors. | |
public class NumericValidationBehavior : Behavior<Entry> | |
{ | |
protected override void OnAttachedTo(Entry entry) | |
{ | |
entry.TextChanged += OnEntryTextChanged; | |
base.OnAttachedTo(entry); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Change default element selected when the screen changes. | |
// In the view controller... | |
public override void ViewDidAppear(bool animated) | |
{ | |
base.ViewDidAppear (animated); | |
//pass in the object to get focus | |
UIAccessibility.PostNotification(UIAccessibilityPostNotification.ScreenChanged, myObject); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ListShuffle | |
{ | |
public static void Shuffle<T>(this IList<T> list) | |
{ | |
Random rng = new Random(); | |
int n = list.Count; | |
while (n > 1) | |
{ | |
n--; | |
int k = rng.Next(n + 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static readonly BindableProperty $name$Property = BindableProperty.Create<$owner$,$type$>(p => p.$name$, default($type$)); | |
public $type$ $name$ | |
{ | |
get { return ($type$)GetValue($name$Property); } | |
set { SetValue($name$Property, value); } | |
}$end$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Syncs a destination with a source. | |
# -a is basically "backup mode" | |
# -v is verbose, which shows each file that gets copied | |
# --delete will delete a file in the destination if it is not in the source | |
sudo rsync -av --delete /Volumes/MyDrive1/ /Volumes/MyDrive2/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public NSIndexPath GetIndexPathFromCellEvent(object sender) | |
{ | |
var point = ((UIButton)sender).ConvertPointToView(((UIButton)sender).AccessibilityActivationPoint, TableView); | |
var indexPath = TableView.IndexPathForRowAtPoint(point); | |
return indexPath; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Step One: Get the raw diffs... usually takes me an hour | |
grep -rq dir1 dir2 > rawdiffs.txt | |
#Step Two: Filter out the junk | |
grep Only rawdiffs.txt | grep -v '.Spotlight' | grep -v '.fseventsd' | grep -v '.DocumentRevisions' | grep -v '.DS_Store' | grep -v '.TemporaryItems' | sort > filteredDiffs.txt |
OlderNewer