Skip to content

Instantly share code, notes, and snippets.

View b099l3's full-sized avatar
🏃‍♂️

Iain Smith b099l3

🏃‍♂️
View GitHub Profile
@sixman9
sixman9 / Load Spatialite library in .NET
Created January 26, 2011 14:40
How to load libspatialite under C#
//'using' System.Data.SQLite;
using (DbConnection connection = new SQLiteConnection("Data Source=" + database)) {
connection.Open(); // load the extension
using (DbCommand command = connection.CreateCommand()) {
//Load the libspatialite library extension - *.dll on windows, *.a on iOS
command.CommandText = "SELECT load_extension('libspatialite-2.dll');";
command.ExecuteNonQuery(); // Run queries here
}
}

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";
@mattt
mattt / uiappearance-selector.md
Last active June 4, 2024 13:28
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
@HeathHopkins
HeathHopkins / ExtensionMethods.cs
Last active April 27, 2022 13:33
Xamarin.iOS Extension Methods
using System;
using MonoTouch.UIKit;
namespace System
{
public static class ExtensionMethods
{
public static UIColor ToUIColor(this string hexString)
{
hexString = hexString.Replace("#", "");
public void DoMagic()
{
// TODO: magic
}
@geirsagberg
geirsagberg / StoryBoardContainer.cs
Last active November 19, 2015 12:02
MvvmCross load views from Storyboards using a custom attribute
public class StoryBoardContainer : MvxTouchViewsContainer
{
protected override IMvxTouchView CreateViewOfType(Type viewType, MvxViewModelRequest request)
{
var storyboardAttribute = viewType.GetCustomAttribute<FromStoryboardAttribute>();
if (storyboardAttribute != null) {
var storyboard = UIStoryboard.FromName(storyboardAttribute.StoryboardName ?? viewType.Name, null);
var viewController = storyboard.InstantiateViewController(viewType.Name);
return (IMvxTouchView) viewController;
}
@softlion
softlion / MvxNetworkActivityIndicatorTargetBinding.cs
Created April 6, 2015 09:16
MvxNetworkActivityIndicatorTargetBinding for mvvmcross iOS
public abstract class MvxTargetBinding2 : MvxBinding, IMvxTargetBinding
{
private readonly object _target;
protected MvxTargetBinding2(object target)
{
_target = target;
}
protected object Target
@geirsagberg
geirsagberg / SubscriptionManager.cs
Created September 24, 2015 08:31
MvvmCross SubscriptionManager
public class SubscriptionManager
{
private Dictionary<Type, MvxSubscriptionToken> subscriptions = new Dictionary<Type, MvxSubscriptionToken>();
public IMvxMessenger Messenger { get; set; }
public SubscriptionManager(IMvxMessenger messenger)
{
Messenger = messenger;
}
@cabeca
cabeca / simulator_populator_xcode7
Last active April 16, 2020 09:18
This script removes and recreates all simulators in Xcode 7.
#!/usr/bin/env ruby
require 'JSON'
device_types = JSON.parse `xcrun simctl list -j devicetypes`
runtimes = JSON.parse `xcrun simctl list -j runtimes`
devices = JSON.parse `xcrun simctl list -j devices`
devices['devices'].each do |runtime, runtime_devices|
runtime_devices.each do |device|
@lopspower
lopspower / README.md
Last active July 25, 2024 17:07
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store