type below:
brew update
brew install redis
To have launchd start redis now and restart at login:
brew services start redis
| import UIKit | |
| class ChatCollectionViewFlowLayout: UICollectionViewFlowLayout { | |
| private var topMostVisibleItem = Int.max | |
| private var bottomMostVisibleItem = -Int.max | |
| private var offset: CGFloat = 0.0 | |
| private var visibleAttributes: [UICollectionViewLayoutAttributes]? |
type below:
brew update
brew install redis
To have launchd start redis now and restart at login:
brew services start redis
| -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | |
| -- -- | |
| -- mysql -- | |
| -- -- | |
| -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | |
| -- | |
| -- mysql <http://sqlfiddle.com/#!9/91afb5/2> | |
| -- note: sqlfiddle is very stupid |
| # thanks to http://exponential.io/blog/2015/01/28/install-cassandra-2_1-on-mac-os-x/ | |
| mkdir -p ~/opt/packages && cd $_ | |
| curl -OL http://downloads.datastax.com/community/dsc.tar.gz | |
| gzip -dc dsc.tar.gz | tar xf - | |
| ln -s ~/opt/packages/dsc-cassandra-3.0.0 ~/opt/cassandra | |
| echo 'if [ -d "$HOME/opt" ]; then | |
| PATH="$PATH:$HOME/opt/cassandra/bin" | |
| fi' >> ~/.bash_profile |
| // | |
| // FileUploader.swift | |
| // | |
| // Copyright (c) 2015 Narciso Cerezo Jiménez. All rights reserved. | |
| // Largely based on this stackoverflow question: http://stackoverflow.com/questions/26121827/uploading-file-with-parameters-using-alamofire/28467829// | |
| import Foundation | |
| import Alamofire | |
| private struct FileUploadInfo { |
| import Foundation | |
| extension String | |
| { | |
| var length: Int { | |
| get { | |
| return countElements(self) | |
| } | |
| } | |
| ActiveAdmin.register Project do | |
| # Don't forget to add the image attribute (here thumbnails) to permitted_params | |
| controller do | |
| def permitted_params | |
| params.permit project: [:title, :summary, :description, :thumbnail, :date, :url, :client_list, :technology_list, :type_list] | |
| end | |
| end | |
| form do |f| |
| #define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate]) | |
| #define UserDefaults [NSUserDefaults standardUserDefaults] | |
| #define NotificationCenter [NSNotificationCenter defaultCenter] | |
| #define SharedApplication [UIApplication sharedApplication] | |
| #define Bundle [NSBundle mainBundle] | |
| #define MainScreen [UIScreen mainScreen] | |
| #define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES | |
| #define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO | |
| #define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x | |
| #define NavBar self.navigationController.navigationBar |
| // #1: Graph API: /me | |
| - (void)requestMe { | |
| [FBRequestConnection startForMeWithCompletionHandler:^(FBRequestConnection *connection, | |
| NSDictionary<FBGraphUser> *me, | |
| NSError *error) { | |
| if(error) { | |
| [self printError:@"Error requesting /me" error:error]; | |
| return; | |
| } | |