Skip to content

Instantly share code, notes, and snippets.

View chrisdiana's full-sized avatar

Chris Diana chrisdiana

View GitHub Profile
@chrisdiana
chrisdiana / gist:aa64509aa50c518c54a5
Created September 9, 2014 17:27
Placeholder for UITextView in Xamarin
// sample text box
var descriptionField = new UITextView (new RectangleF (0, 230, UIScreen.MainScreen.Bounds.Width, 100)){
BackgroundColor = UIColor.White,
Text = " Description:",
TextColor = ViewHelpers.DarkGray,
Font = UIFont.FromName("Helvetica", 18f)
};
// some work arounds for UITextView placeholders
var Placeholder = " Description:";
descriptionField.ShouldBeginEditing = t => {
@chrisdiana
chrisdiana / gist:5045a2322fe832fe32ca
Last active August 29, 2015 14:06
Text Box Validation for UITextView in Xamarin
// sample text box
var descriptionField = new UITextView (new RectangleF (0, 230, UIScreen.MainScreen.Bounds.Width, 100)){
BackgroundColor = UIColor.White,
Text = " Description:",
TextColor = ViewHelpers.DarkGray,
Font = UIFont.FromName("Helvetica", 18f)
};
// validation
descriptionField.ShouldEndEditing = t => {
if (string.IsNullOrEmpty (descriptionField.Text)) {
@chrisdiana
chrisdiana / gist:39b8a7da06c1da5ce14f
Last active August 29, 2015 14:06
Text Field Validation for UITextField in Xamarin
// sample text field
var titleField = new UITextField (new RectangleF (0, 160, UIScreen.MainScreen.Bounds.Width, 50)){
BackgroundColor = UIColor.White,
TextColor = ViewHelpers.DarkGray,
Placeholder = "Title:"
};
// validation
titleField.EditingDidEnd += (object sender, EventArgs e) => {
if ( ((UITextField)sender).Text.Length <= 0 ) {
InvokeOnMainThread ( () => {
@chrisdiana
chrisdiana / gist:c9e2851fd02b3d903849
Created September 30, 2014 17:22
Console dump objects one property at a time to JSON in C#
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(
someObject, Formatting.Indented));
@chrisdiana
chrisdiana / new_gist_file.html
Created November 11, 2014 06:35
The Best IE Warning
<!--[if lte IE 6]>
<div style="background-color:#FFFFCC;padding:15px;border:solid 1px #000000;margin-bottom:20px;">
<h1 style="color:#000000;margin-bottom:10px;">Warning - Unsupported Browser</h1>
<p>You are using an outdated version of Internet Explorer that has security issues and does not support global web standards. To ensure you have a better user experience online, across all sites (that includes capitolsales.com), we recommend that you upgrade <a class="getie7" href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx" target="_blank">your version of Internet Explorer</a> or choose any of these <strong>other excellent browsers</strong>: <a href="http://www.opera.com/download/" target="_blank">Opera</a>, <a href="http://www.mozilla.com/firefox/" target="_blank">Firefox</a>, <a href="http://www.apple.com/safari/download/" target="_blank">Safari</a> or <a href="http://www.google.com/chrome" target="_blank">Chrome</a>. It's free!</p>
</div>
<![endif]-->
@chrisdiana
chrisdiana / gist:c1b4a070454fdacaab9e
Last active August 29, 2015 14:14
Hide App Icon from Dock in OS X
# Locate the 'Info.plist' by right clicking app and 'Show Package Contents'
# Add this just before the closing of the `</dict>` tag near where you see
# something similar to `<string>MainMenu</string><key>NSPrincipalClass</key>`
<key>LSUIElement</key>
<true/>
@chrisdiana
chrisdiana / jquertips.md
Created October 22, 2015 16:45
jQuery Tips
@chrisdiana
chrisdiana / gist:f0777eb35a5adece8422
Last active November 2, 2017 16:20
Reset GIT to commit force push
# Local reset:
git reset --hard fj5789sufj
# Remote reset:
git push -f origin fj5789sufj:master
@chrisdiana
chrisdiana / funterm.txt
Created August 11, 2015 18:19
Fun with Terminal
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ██
█▌ - FUN ON THE TERMINAL - █▌
█▌ PUBLIC TELNET ASCII ART, GAMES, ETC (ALL OSes) █▌
█ ▐▌
█ ▐▌
█ Connect to other servers through telnet to view their animated ASCII art, ▐▌
█ games, etc they offer the public. If no port is specified than it is the ▐▌
█ default port 23; you don't need to specify it. ▐▌
█ ▐▌
@chrisdiana
chrisdiana / gist:04431f0c8cf75a1e90a7
Created September 9, 2014 17:32
Add Done and Dismiss Keyboard for UITextView in Xamarin
// sample text box
var deedDescriptionField = new UITextView (new RectangleF (0, 230, UIScreen.MainScreen.Bounds.Width, 100)){
BackgroundColor = UIColor.White,
Text = " Description:",
TextColor = ViewHelpers.DarkGray,
Font = UIFont.FromName("Helvetica", 18f)
};
// change the return key to done
descriptionField.ReturnKeyType = UIReturnKeyType.Done;
// dismiss keyboard on done