sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
require 'fileutils' | |
require 'optimist' | |
require 'plist' | |
def run(path, source_path) | |
process(path, source_path, '**/*.app', true) | |
process(path, source_path, '**/*.dylib', false) | |
end | |
def process(path, source_path, search_pattern, is_app) |
// The issue with sectionHeadersPinToVisibleBounds and sectionFootersPinToVisibleBounds is that they do not pin | |
// first header and last footer when bouncing. This layout subclass fixes that. | |
class StickyLayout: UICollectionViewFlowLayout { | |
override init() { | |
super.init() | |
self.sectionFootersPinToVisibleBounds = true | |
self.sectionHeadersPinToVisibleBounds = true | |
} |
* Reducing executable size: | |
http://developer.xamarin.com/guides/cross-platform/deployment,_testing,_and_metrics/memory_perf_best_practices/#Reducing_Executable_Size | |
* Use the linker (iOS [1], Android [2]) to remove unnecessary code from your assemblies | |
[1] https://developer.xamarin.com/guides/ios/advanced_topics/linker | |
[2] https://developer.xamarin.com/guides/android/advanced_topics/linking | |
* Reference third-party libraries judiciously | |
* Applying constraints to generics may reduce app size, since less code would need to be included (haven’t verified this) |
TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
// MARK: Using NSURLSession | |
// Get first todo item | |
let todoEndpoint: String = "http://jsonplaceholder.typicode.com/todos/1" | |
guard let url = NSURL(string: todoEndpoint) else { | |
print("Error: cannot create URL") | |
return | |
} | |
let urlRequest = NSURLRequest(URL: url) |
# Custom rspec matcher for testing CanCan abilities. | |
# Originally inspired by https://github.com/ryanb/cancan/wiki/Testing-Abilities | |
# | |
# Usage: | |
# should have_abilities(:create, Post.new) | |
# should have_abilities([:read, :update], post) | |
# should have_abilities({manage: false, destroy: true}, post) | |
# should have_abilities({create: false}, Post.new) | |
# should not_have_abilities(:update, post) | |
# should not_have_abilities([:update, :destroy], post) |
# lib/tasks/db.rake | |
namespace :db do | |
desc "Dumps the database to db/APP_NAME.dump" | |
task :dump => :environment do | |
cmd = nil | |
with_config do |app, host, db, user| | |
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
end | |
puts cmd |
<?php | |
/** | |
* I18N class for translating text to any language | |
* Uses YAML files | |
* | |
* Usage: I18N::t("user.name") # => "Karl Metum" | |
* In the above example "name" is nested under "user" | |
* | |
* Make sure that the following constants are set in | |
* your configuration file: |