- Create a
.zshrcfile if it does not exist using the next command:
touch ~/.zshrc - Open
~/.zshrcand add the next content:
# git branch
function parse_git_branch() {
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}
.zshrc file if it does not exist using the next command: touch ~/.zshrc~/.zshrc and add the next content:# git branch
function parse_git_branch() {
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}
| using System.Linq; | |
| using System.Text; | |
| using Android.Text; | |
| using Android.Text.Style; | |
| using Android.Widget; | |
| using MyNamespace.Effects; | |
| using Xamarin.Forms; | |
| using Xamarin.Forms.Platform.Android; | |
| using static Android.Widget.TextView; |
| public class SettingsHelper | |
| { | |
| public void OpenAppSettings() | |
| { | |
| var intent = new Intent(Android.Provider.Settings.ActionApplicationDetailsSettings); | |
| intent.AddFlags(ActivityFlags.NewTask); | |
| var uri = Android.Net.Uri.FromParts("package", package_name, null); | |
| intent.SetData(uri); | |
| Application.Context.StartActivity(intent); | |
| } |
Source: https://montemagno.com/how-to-convert-a-pcl-library-to-net-standard-and-keep-git-history/
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
| public class Startup | |
| { | |
| public Startup(IConfiguration configuration) | |
| { | |
| Configuration = configuration; | |
| } | |
| public IConfiguration Configuration { get; } | |
| // This method gets called by the runtime. Use this method to add services to the container. |
| using Android.Content; | |
| using WebViewWithProgressBar.Droid; | |
| using Xamarin.Forms; | |
| using Xamarin.Forms.Platform.Android; | |
| // https://stackoverflow.com/a/8467430/1970317 | |
| [assembly: ExportRenderer(typeof(WebView), typeof(GenericWebViewRenderer))] | |
| namespace WebViewWithProgressBar.Droid | |
| { | |
| public class GenericWebViewRenderer : WebViewRenderer |
| /* | |
| * First commit any outstanding code changes before executing this command. | |
| * Source: https://stackoverflow.com/a/38451183/1970317 | |
| */ | |
| git rm -r --cached . | |
| git add . | |
| git commit -m "Fix .gitignore by {UPDATE}" |
| public class ClipboardService : IClipboardService | |
| { | |
| public string GetTextFromClipboard() | |
| { | |
| var clipboardmanager = (ClipboardManager)Forms.Context.GetSystemService(Context.ClipboardService); | |
| var item = clipboardmanager.PrimaryClip.GetItemAt(0); | |
| var text = item.Text; | |
| return text; | |
| } |
| # Recursively find and delete "bin", "obj" and "packages" dirs | |
| # Backup your code before using this script, I am not responsible for any data loss. Please use it wisely. | |
| find . -iname "bin" -o -iname "obj" -o -iname "packages" | xargs rm -rf |
| using System; | |
| using System.Net; | |
| using System.Net.Http; | |
| using System.Web.Http.Controllers; | |
| using System.Web.Http.Filters; | |
| namespace MyAwesomeWebApi.ActionFilters | |
| { | |
| /// <summary> | |
| /// Returns 400 if the ModelState is invalid. |