Skip to content

Instantly share code, notes, and snippets.

View isSenderSameAsRecipient.swift
private func isSenderSameAsRecipient() -> Bool {
guard let conversation = activeConversation else { return false }
guard let message = conversation.selectedMessage else { return false }
return message.senderParticipantIdentifier == conversation.localParticipantIdentifier
}
View ComposeMessage.swift
private func composeMessage() {
let conversation = activeConversation
let session = conversation?.selectedMessage?.session ?? MSSession()
let layout = MSMessageTemplateLayout()
layout.image = UIImage(named: "message-background.png")
layout.imageTitle = "iMessage Extension"
layout.caption = "Hello world!"
layout.subcaption = "Sent by /(conversation?.localParticipantIdentifier)"
View ComposeMessage.swift
private func composeMessage() {
let conversation = activeConversation
let session = conversation?.selectedMessage?.session ?? MSSession()
let layout = MSMessageTemplateLayout()
layout.image = UIImage(named: "message-background.png")
layout.imageTitle = "iMessage Extension"
layout.caption = "Hello world!"
layout.subcaption = "Sent by /(conversation?.localParticipantIdentifier)"
View ComposeMessage.swift
private func composeMessage() {
let session = MSSession()
let layout = MSMessageTemplateLayout()
layout.image = UIImage(named: "message-background.png")
layout.imageTitle = "iMessage Extension"
layout.caption = "Hello world!"
let message = MSMessage(session: session)
message.layout = layout
View ComposeMessage.swift
private func composeMessage() {
let layout = MSMessageTemplateLayout()
layout.image = UIImage(named: "message-background.png")
layout.imageTitle = "iMessage Extension"
layout.caption = "Hello world!"
let message = MSMessage()
message.shouldExpire = true
message.layout = layout
}
View MessagesViewController.swift
class CompactViewController: UIViewController {
// ...
}
class ExpandedViewController: UIViewController {
// ...
}
class MessagesViewController: MSMessagesAppViewController {
override func willBecomeActive(with conversation: MSConversation) {
@bartkozal
bartkozal / text.md
Last active May 6, 2016
How I run a server or deploy across various projects with a single shell command
View text.md

I work on various projects and always forget what should I type to run a server, do a deploy etc. So, how I dealt with this problem and have a single shell command for that?

Add to your global .gitignore:

.exec

Add the following function to your .zshrc/.bashrc:

View gist:4f4080ee87f177e87607
RUBY_GC_HEAP_FREE_SLOTS=600000
RUBY_GC_HEAP_GROWTH_FACTOR=1.25
RUBY_GC_HEAP_GROWTH_MAX_SLOTS=300000
RUBY_GC_HEAP_INIT_SLOTS=600000
RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.3
RUBY_GC_MALLOC_LIMIT=64000000
RUBY_GC_OLDMALLOC_LIMIT=64000000
RUBY_HEAP_FREE_MIN=12500
RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
RUBY_HEAP_SLOTS_INCREMENT=100000
@bartkozal
bartkozal / vim.rb
Created Aug 22, 2012 — forked from uasi/vim.rb
Vim formula for Homebrew
View vim.rb
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.618'
def features; %w(tiny small normal big huge) end
You can’t perform that action at this time.