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
//Method 1: No restrictions | |
((NSString)t.Text).GetSizeUsingAttributes(new UIStringAttributes {Font = t.Font}); | |
//Method 2: Has to fit within a width | |
label.Frame = new CGRect(CGPoint.Empty, ((NSString)label.Text).GetBoundingRect( | |
new CGSize(width, nfloat.MaxValue), | |
NSStringDrawingOptions.UsesLineFragmentOrigin, | |
new UIStringAttributes { Font = label.Font}, | |
null | |
).Size); |
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
/* | |
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)); |
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 UIImage AsImage(this UIView view) | |
{ | |
UIGraphics.BeginImageContextWithOptions(view.Bounds.Size, true, 0); | |
view.Layer.RenderInContext(UIGraphics.GetCurrentContext()); | |
var img = UIGraphics.GetImageFromCurrentImageContext(); | |
UIGraphics.EndImageContext(); | |
return img; | |
} |
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
#!/bin/bash | |
# file name to be split | |
input=$1 | |
# text to prepend to the file name of the slices | |
prepend=$2 | |
# counter for the slices | |
slice_counter=1 | |
# current start | |
start=0 |
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
# run the command with nohup | |
nohup npm run my-process & | |
# check that it's running | |
jobs | |
# detach your session from that job | |
disown -h %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 class IOHelper | |
{ | |
public enum IosSpecialFolder | |
{ | |
Documents, | |
Library, | |
Cache, | |
Preferences, | |
Tmp | |
} |
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
//db interface in shared pcl | |
using System; | |
using SQLite.Net; | |
namespace SampleApp | |
{ | |
public interface ISQLite | |
{ | |
SQLiteConnection GetConnection(); |
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
class Node: | |
def __init__(self, label=None, data=None): | |
self.label = label | |
self.data = data | |
self.children = dict() | |
def addChild(self, key, data=None): | |
if not isinstance(key, Node): | |
self.children[key] = Node(key, data) | |
else: |
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
sudo apt-get update | |
sudo apt-get install -y apt-transport-https ca-certificates | |
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D | |
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list | |
sudo apt-get update | |
sudo apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual | |
sudo apt-get install -y docker-engine | |
sudo service docker start | |
sudo docker pull php:5.6-apache |
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
[alias] | |
dt = difftool | |
mt = mergetool | |
[diff] | |
tool = bc3 | |
[difftool] | |
prompt = false | |
[difftool "bc3"] | |
cmd = \"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" | |
[difftool "p4"] |
NewerOlder