(C-x means ctrl+x, M-x means alt+x)
The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:
| import SwiftUI | |
| import Combine | |
| struct OnScroll: ViewModifier { | |
| @Binding var offset: CGFloat | |
| //we can have a version with a closure instead of the binding, but that triggers an infinite loop if content depends on the same Store | |
| // var onOffset: (CGFloat) -> () | |
| func body(content: Content) -> some View { | |
| return VStack { |
| extension Collection where Element == Int, Index == Int { | |
| /// Calculates a moving average. | |
| /// - Parameter period: the period to calculate averages for. | |
| /// - Warning: the supplied `period` must be larger than 1. | |
| /// - Warning: the supplied `period` should not exceed the collection's `count`. | |
| /// - Returns: a dictionary of indexes and averages. | |
| func movingAverage(period: Int) -> [Int: Float] { | |
| precondition(period > 1) | |
| precondition(count > period) |
| import UIKit | |
| import Photos | |
| extension PHPhotoLibrary { | |
| // MARK: - PHPhotoLibrary+SaveImage | |
| // MARK: - Public | |
| func savePhoto(image:UIImage, albumName:String, completion:((PHAsset?)->())? = nil) { | |
| func save() { |
| // Swift version of: https://gist.github.com/smileyborg/a5d1355773ad2ba6bb1e | |
| public enum ViewOrientation { | |
| case Portrait | |
| case Landscape | |
| } | |
| extension UIView { | |
| public class func viewOrientationForSize(size:CGSize) -> ViewOrientation { | |
| return (size.width > size.height) ? .Landscape : .Portrait |
| require "active_record" | |
| namespace :db do | |
| db_config = YAML::load(File.open('config/database.yml')) | |
| db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'}) | |
| desc "Create the database" | |
| task :create do | |
| ActiveRecord::Base.establish_connection(db_config_admin) |
| class Api::RegistrationsController < Api::BaseController | |
| respond_to :json | |
| def create | |
| user = User.new(params[:user]) | |
| if user.save | |
| render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
| return | |
| else |
| class Api::RegistrationsController < Api::BaseController | |
| respond_to :json | |
| def create | |
| user = User.new(params[:user]) | |
| if user.save | |
| render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
| return | |
| else |