This file contains hidden or 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
let myTable = MLDataTable(...) | |
// Fetch the price column (and all it's values) | |
let priceColumn = myTable["price"] | |
// Create a new column that contains values that are the result of | |
// price * bedroom for each row | |
let priceTimesBedroomsColumn = myTable["price"] * myTable["bedrooms"] | |
// Remove rows that contain less that 2 bedrooms |
This file contains hidden or 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
# Get Sudo. | |
if [ $EUID != 0 ]; then | |
sudo "$0" "$@" | |
exit $? | |
fi | |
# Install Xcode first - https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12 | |
# Install Xcode command line tools. | |
xcode-select --install |
This file contains hidden or 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
self.cntView.layer.cornerRadius = 13.0 | |
self.cntView.layer.shadowColor = UIColor.lightGray.cgColor | |
self.cntView.layer.shadowOpacity = 0.5 | |
self.cntView.layer.shadowRadius = 10.0 | |
self.cntView.layer.shadowOffset = .zero | |
self.cntView.layer.shadowPath = UIBezierPath(rect: self.cntView.bounds).cgPath | |
self.cntView.layer.shouldRasterize = true | |
//Note:- cntView is an IBOutlet |
This file contains hidden or 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
func isModal() -> Bool { | |
return self.presentingViewController?.presentedViewController == self | |
|| (self.navigationController != nil && self.navigationController?.presentingViewController?.presentedViewController == self.navigationController) | |
|| self.tabBarController?.presentingViewController is UITabBarController | |
} |
This file contains hidden or 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
func copyDatabaseIfNeeded() { | |
// Move database file from bundle to documents folder | |
let fileManager = FileManager.default | |
let documentsUrl = fileManager.urls(for: .documentDirectory, | |
in: .userDomainMask) | |
guard documentsUrl.count != 0 else { | |
return // Could not find documents URL |
This file contains hidden or 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
1. Open Terminal | |
2. cd to your Xcode project | |
3. Execute the following when inside your target project: | |
find . -name "*.swift" -print0 | xargs -0 wc -l |
This file contains hidden or 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 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 |
This file contains hidden or 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
import UIKit | |
import AsyncDisplayKit | |
var calculatedWidth: CGFloat = 0 | |
class ViewController: UIViewController { | |
// MARK: Properties | |
private let containerNode: WidthTestContainerNode |
This file contains hidden or 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
- semantic_form_for @question do |f| | |
= f.input :title, :label => "Type Your Question", | |
:wrapper_html => {:style => "list-style-type:none"}, | |
:input_html => {:class => 'main_question'} | |
= f.input :body, :input_html => {:class => 'autogrow', :rows => 5}, | |
:wrapper_html => {:style => "list-style-type:none"}, | |
:label => "Question Details (optional)" | |
= f.input :tag_list, :class => 'larger widest', :"data-pre" => @question.tags.map(&:attributes).to_json, | |
:wrapper_html => {:style => "list-style-type:none"} | |
NewerOlder